Section: Linux Programmer's Manual (2)
move_pages - move individual pages of a process to another node
long move_pages(int pid, unsigned long count, void **pages,
const int *nodes, int *status, int flags);
Link with -lnuma.
moves the specified
of the process
to the memory nodes specified by
The result of the move is reflected in
indicate constraints on the pages to be moved.
is the ID of the process in which pages are to be moved.
is 0, then
moves pages of the calling process.
To move pages in another process requires the following privileges:
In kernels up to and including Linux 4.12:
the caller must be privileged
or the real or effective user ID of the calling process must match the
real or saved-set user ID of the target process.
The older rules allowed the caller to discover various
virtual address choices made by the kernel that could lead
to the defeat of address-space-layout randomization
for a process owned by the same UID as the caller,
the rules were changed starting with Linux 4.13.
Since Linux 4.13,
permission is governed by a ptrace access mode
check with respect to the target process; see
is the number of pages to move.
It defines the size of the three arrays
is an array of pointers to the pages that should be moved.
These are pointers that should be aligned to page boundaries.
Addresses are specified as seen by the process specified by
is an array of integers that specify the desired location for each page.
Each element in the array is a node number.
can also be NULL, in which case
does not move any pages but instead will return the node
where each page currently resides, in the
Obtaining the status of each page may be necessary to determine
pages that need to be moved.
is an array of integers that return the status of each page.
The array contains valid values only if
did not return an error.
Preinitialization of the array to a value
which cannot represent a real numa node or valid error of status array
could help to identify pages that have been migrated.
specify what types of pages to move.
means that only pages that are in exclusive use by the process
are to be moved.
means that pages shared between multiple processes can also be moved.
The process must be privileged
Page states in the status array
The following values can be returned in each element of the
Identifies the node on which the page resides.
The page is mapped by multiple processes and can be moved only if
The page is currently busy and cannot be moved.
Try again later.
This occurs if a page is undergoing I/O or another kernel subsystem
is holding a reference to the page.
This is a zero page or the memory area is not mapped by the process.
Unable to write back a page.
The page has to be written back
in order to move it since the page is dirty and the filesystem
does not provide a migration function that would allow the move
of dirty pages.
A dirty page cannot be moved.
The filesystem does not
provide a migration function and has no ability to write back pages.
The page is not present.
Unable to allocate memory on target node.
On error, it returns -1, and sets
to indicate the error.
If positive value is returned, it is the number of
- Positive value
The number of nonmigrated pages if they were the result of nonfatal
Too many pages to move.
Since Linux 2.6.29,
the kernel no longer generates this error.
One of the target nodes is not allowed by the current cpuset.
Parameter array could not be accessed.
Flags other than
was specified or an attempt was made to migrate pages of a kernel thread.
One of the target nodes is not online.
The caller specified
without sufficient privileges
Or, the caller attempted to move pages of a process belonging
to another user but did not have privilege to do so
Process does not exist.
first appeared on Linux in version 2.6.18.
This system call is Linux-specific.
For information on library support, see
flag to obtain the set of nodes that are allowed by
the current cpuset.
Note that this information is subject to change at any
time by manual or automatic reconfiguration of the cpuset.
Use of this function may result in pages whose location
(node) violates the memory policy established for the
specified addresses (See
and/or the specified process (See
That is, memory policy does not constrain the destination
nodes used by
header is not included with glibc, but requires installing
or a similar package.
This page is part of release 5.10 of the Linux
A description of the project,
information about reporting bugs,
and the latest version of this page,
can be found at