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

NAME

6       migrate_pages - move all pages in a process to another set of nodes
7

SYNOPSIS

9       #include <numaif.h>
10
11       long migrate_pages(int pid, unsigned long maxnode,
12                          const unsigned long *old_nodes,
13                          const unsigned long *new_nodes);
14
15       Note: There is no glibc wrapper for this system call; see NOTES.
16
17       Link with -lnuma.
18

DESCRIPTION

20       migrate_pages()  attempts to move all pages of the process pid that are
21       in memory nodes old_nodes to the memory nodes in new_nodes.  Pages  not
22       located  in any node in old_nodes will not be migrated.  As far as pos‐
23       sible, the kernel maintains the relative topology  relationship  inside
24       old_nodes during the migration to new_nodes.
25
26       The old_nodes and new_nodes arguments are pointers to bit masks of node
27       numbers, with up to maxnode bits in each mask.  These masks  are  main‐
28       tained  as  arrays of unsigned long integers (in the last long integer,
29       the bits beyond those specified by maxnode are ignored).   The  maxnode
30       argument  is  the maximum node number in the bit mask plus one (this is
31       the same as in mbind(2), but different from select(2)).
32
33       The pid argument is the ID of the process whose pages are to be  moved.
34       To  move  pages  in  another  process,  the  caller  must be privileged
35       (CAP_SYS_NICE) or the real or effective user ID of the calling  process
36       must match the real or saved-set user ID of the target process.  If pid
37       is 0, then migrate_pages() moves pages of the calling process.
38
39       Pages shared with another process will be moved only if the  initiating
40       process has the CAP_SYS_NICE privilege.
41

RETURN VALUE

43       On  success  migrate_pages() returns the number of pages that could not
44       be moved (i.e., a return of zero means that all pages were successfully
45       moved).  On error, it returns -1, and sets errno to indicate the error.
46

ERRORS

48       EFAULT Part or all of the memory range specified by old_nodes/new_nodes
49              and maxnode points outside your accessible address space.
50
51       EINVAL The value specified by maxnode exceeds a  kernel-imposed  limit.
52              Or,  old_nodes  or new_nodes specifies one or more node IDs that
53              are greater than the maximum supported node ID.  Or, none of the
54              node  IDs  specified by new_nodes are on-line and allowed by the
55              process's current cpuset context, or none of the specified nodes
56              contain memory.
57
58       EPERM  Insufficient  privilege  (CAP_SYS_NICE)  to  move  pages  of the
59              process   specified   by   pid,   or   insufficient    privilege
60              (CAP_SYS_NICE) to access the specified target nodes.
61
62       ESRCH  No process matching pid could be found.
63

VERSIONS

65       The  migrate_pages()  system  call  first  appeared on Linux in version
66       2.6.16.
67

CONFORMING TO

69       This system call is Linux-specific.
70

NOTES

72       Glibc does not provide a wrapper for this system call.  For information
73       on library support, see numa(7).
74
75       Use  get_mempolicy(2)  with  the MPOL_F_MEMS_ALLOWED flag to obtain the
76       set of nodes that are allowed by the calling  process's  cpuset.   Note
77       that this information is subject to change at any time by manual or au‐
78       tomatic reconfiguration of the cpuset.
79
80       Use of migrate_pages() may result in pages whose location  (node)  vio‐
81       lates  the  memory  policy established for the specified addresses (see
82       mbind(2)) and/or the specified process  (see  set_mempolicy(2)).   That
83       is,  memory policy does not constrain the destination nodes used by mi‐
84       grate_pages().
85
86       The <numaif.h> header is not included  with  glibc,  but  requires  in‐
87       stalling libnuma-devel or a similar package.
88

SEE ALSO

90       get_mempolicy(2),  mbind(2),  set_mempolicy(2),  numa(3), numa_maps(5),
91       cpuset(7), numa(7), migratepages(8), numastat(8)
92
93       Documentation/vm/page_migration.rst in the Linux kernel source tree
94

COLOPHON

96       This page is part of release 5.12 of the Linux  man-pages  project.   A
97       description  of  the project, information about reporting bugs, and the
98       latest    version    of    this    page,    can     be     found     at
99       https://www.kernel.org/doc/man-pages/.
100
101
102
103Linux                             2021-03-22                  MIGRATE_PAGES(2)
Impressum