Linux "move_pages" Command Line Options and Examples
move individual pages of a process to another node

move_pages() moves the specified pages of the process pid to the memory nodes specified by nodes. The result of the move is reflected in status. The flags indicate constraints on the pages to be moved.


Usage:

#include <numaif.h>


    long move_pages(int pid, unsigned long count, void **pages,
            const int *nodes, int *status, int flags);


    Link with -lnuma.




Command Line Options:

-EACCES
The page is mapped by multiple processes and can be moved only if MPOL_MF_MOVE_ALL is specified.
move_pages -EACCES ...
-EFAULT
This is a zero page or the memory area is not mapped by the process.
move_pages -EFAULT ...
-EINVAL
A dirty page cannot be moved. The filesystem does not provide a migration function and has no ability to write back pages.
move_pages -EINVAL ...
-ENOENT
The page is not present.
move_pages -ENOENT ...
-ENOMEM
Unable to allocate memory on target node.RETURN VALUEOn success move_pages() returns zero. On error, it returns -1, and sets errno to indicate the error.ERRORSE2BIG Too many pages to move.EACCES One of the target nodes is not allowed by the current cpuset.EFAULT Parameter array could not be accessed.EINVAL Flags other than MPOL_MF_MOVE and MPOL_MF_MOVE_ALL was specified or an attempt was made to migrate pages of a kernel thread.ENODEV One of the target nodes is not online.ENOENT No pages were found that require moving. All pages are either already on the target node, not present, had an invalid addressor could not be moved because they were mapped by multiple processes.EPERM The caller specified MPOL_MF_MOVE_ALL without sufficient privileges (CAP_SYS_NICE). Or, the caller attempted to move pages ofa process belonging to another user but did not have privilege to do so (CAP_SYS_NICE).ESRCH Process does not exist.VERSIONSmove_pages() first appeared on Linux in version 2.6.18.CONFORMING TOThis system call is Linux-specific.NOTESFor information on library support, see numa(7).Use get_mempolicy(2) with the MPOL_F_MEMS_ALLOWED flag to obtain the set of nodes that are allowed by the current cpuset. Note thatthis 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 mbind(2)) and/or the specified process (See set_mempolicy(2)). That is, memory policy does not constrain the destination nodesused by move_pages().The <numaif.h> header is not included with glibc, but requires installing libnuma-devel or a similar package.
move_pages -ENOMEM ...