1MOVE_PAGES(2)              Linux Programmer's Manual             MOVE_PAGES(2)
2
3
4

NAME

6       move_pages - move individual pages of a process to another node
7

SYNOPSIS

9       #include <numaif.h>
10
11       long move_pages(int pid, unsigned long count, void **pages,
12                       const int *nodes, int *status, int flags);
13
14       Link with -lnuma.
15

DESCRIPTION

17       move_pages() moves the specified pages of the process pid to the memory
18       nodes specified by nodes.  The result of the move is reflected in  sta‐
19       tus.  The flags indicate constraints on the pages to be moved.
20
21       pid  is  the ID of the process in which pages are to be moved.  To move
22       pages in another process, the caller must be privileged  (CAP_SYS_NICE)
23       or  the real or effective user ID of the calling process must match the
24       real or saved-set user ID of the target process.  If  pid  is  0,  then
25       move_pages() moves pages of the calling process.
26
27       count is the number of pages to move.  It defines the size of the three
28       arrays pages, nodes, and status.
29
30       pages is an array of pointers to the pages that should be moved.  These
31       are  pointers that should be aligned to page boundaries.  Addresses are
32       specified as seen by the process specified by pid.
33
34       nodes is an array of integers that specify  the  desired  location  for
35       each page.  Each element in the array is a node number.  nodes can also
36       be NULL, in which case move_pages() does not move any pages but instead
37       will  return  the node where each page currently resides, in the status
38       array.  Obtaining the status of each page may be necessary to determine
39       pages that need to be moved.
40
41       status  is  an  array  of integers that return the status of each page.
42       The array only contains valid values if move_pages() did not return  an
43       error.
44
45       flags  specify  what  types  of pages to move.  MPOL_MF_MOVE means that
46       only pages that are in exclusive use by the process are  to  be  moved.
47       MPOL_MF_MOVE_ALL means that pages shared between multiple processes can
48       also be moved.  The process must be privileged  (CAP_SYS_NICE)  to  use
49       MPOL_MF_MOVE_ALL.
50

Page states in the status array

52       The  following  values  can  be  returned in each element of the status
53       array.
54
55       0..MAX_NUMNODES
56              Identifies the node on which the page resides.
57
58       -EACCES
59              The page is mapped by multiple processes and can only  be  moved
60              if MPOL_MF_MOVE_ALL is specified.
61
62       -EBUSY The  page  is  currently  busy  and  cannot be moved.  Try again
63              later.  This occurs if a page is undergoing I/O or another  ker‐
64              nel subsystem is holding a reference to the page.
65
66       -EFAULT
67              This  is  a  zero  page  or the memory area is not mapped by the
68              process.
69
70       -EIO   Unable to write back a page.  The page has to be written back in
71              order  to  move  it  since the page is dirty and the file system
72              does not provide a migration function that would allow the  move
73              of dirty pages.
74
75       -EINVAL
76              A  dirty page cannot be moved.  The file system does not provide
77              a migration function and has no ability to write back pages.
78
79       -ENOENT
80              The page is not present.
81
82       -ENOMEM
83              Unable to allocate memory on target node.
84

RETURN VALUE

86       On success move_pages() returns zero.  On error,  it  returns  -1,  and
87       sets errno to indicate the error.
88

ERRORS

90       E2BIG  Too many pages to move.
91
92       EACCES One of the target nodes is not allowed by the current cpuset.
93
94       EFAULT Parameter array could not be accessed.
95
96       EINVAL Flags other than MPOL_MF_MOVE and MPOL_MF_MOVE_ALL was specified
97              or an attempt was made to migrate pages of a kernel thread.
98
99       ENODEV One of the target nodes is not online.
100
101       ENOENT No pages were found that require moving.  All pages  are  either
102              already  on the target node, not present, had an invalid address
103              or could not be moved because they were mapped by multiple  pro‐
104              cesses.
105
106       EPERM  The  caller specified MPOL_MF_MOVE_ALL without sufficient privi‐
107              leges (CAP_SYS_NICE).  Or, the caller attempted to move pages of
108              a  process  belonging to another user but did not have privilege
109              to do so (CAP_SYS_NICE).
110
111       ESRCH  Process does not exist.
112

VERSIONS

114       move_pages() first appeared on Linux in version 2.6.18.
115

CONFORMING TO

117       This system call is Linux-specific.
118

NOTES

120       For information on library support, see numa(7).
121
122       Use get_mempolicy(2) with the MPOL_F_MEMS_ALLOWED flag  to  obtain  the
123       set  of  nodes  that are allowed by the current cpuset.  Note that this
124       information is subject to change at any time  by  manual  or  automatic
125       reconfiguration of the cpuset.
126
127       Use of this function may result in pages whose location (node) violates
128       the  memory  policy  established  for  the  specified  addresses   (See
129       mbind(2))  and/or  the  specified process (See set_mempolicy(2)).  That
130       is, memory policy does not constrain  the  destination  nodes  used  by
131       move_pages().
132
133       The  <numaif.h>  header  is  not  included  with  glibc,  but  requires
134       installing libnuma-devel or a similar package.
135

SEE ALSO

137       get_mempolicy(2), mbind(2),  set_mempolicy(2),  numa(3),  numa_maps(5),
138       cpuset(7), numa(7), migratepages(8), numa_stat(8)
139

COLOPHON

141       This  page  is  part of release 3.25 of the Linux man-pages project.  A
142       description of the project, and information about reporting  bugs,  can
143       be found at http://www.kernel.org/doc/man-pages/.
144
145
146
147Linux                             2010-06-11                     MOVE_PAGES(2)
Impressum