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

DESCRIPTION

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

Page states in the status array

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

RETURN VALUE

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

ERRORS

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

VERSIONS

112       move_pages() first appeared on Linux in version 2.6.18.
113

CONFORMING TO

115       This system call is Linux-specific.
116

NOTES

118       For information on library support, see numa(7).
119
120       Use get_mempolicy(2) with the MPOL_F_MEMS_ALLOWED flag  to  obtain  the
121       set  of  nodes  that are allowed by the current cpuset.  Note that this
122       information is subject to change at any time  by  manual  or  automatic
123       reconfiguration of the cpuset.
124
125       Use of this function may result in pages whose location [node] violates
126       the  memory  policy  established  for  the  specified  addresses   [See
127       mbind(2)]  and/or  the  specified process [See set_mempolicy(2)].  That
128       is, memory policy does not constrain  the  destination  nodes  used  by
129       move_pages().
130

SEE ALSO

132       get_mempolicy(2),  mbind(2),  set_mempolicy(2),  numa(3), numa_maps(5),
133       cpuset(7), numa(7), migratepages(8), numa_stat(8)
134

COLOPHON

136       This page is part of release 3.22 of the Linux  man-pages  project.   A
137       description  of  the project, and information about reporting bugs, can
138       be found at http://www.kernel.org/doc/man-pages/.
139
140
141
142Linux                             2008-10-06                     MOVE_PAGES(2)
Impressum