1migrate_pages(2)              System Calls Manual             migrate_pages(2)
2
3
4

NAME

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

LIBRARY

9       NUMA (Non-Uniform Memory Access) policy library (libnuma, -lnuma)
10

SYNOPSIS

12       #include <numaif.h>
13
14       long migrate_pages(int pid, unsigned long maxnode,
15                          const unsigned long *old_nodes,
16                          const unsigned long *new_nodes);
17

DESCRIPTION

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

RETURN VALUE

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

ERRORS

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

STANDARDS

64       Linux.
65

HISTORY

67       Linux 2.6.16.
68

NOTES

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

SEE ALSO

87       get_mempolicy(2),  mbind(2),  set_mempolicy(2),  numa(3), numa_maps(5),
88       cpuset(7), numa(7), migratepages(8), numastat(8)
89
90       Documentation/vm/page_migration.rst in the Linux kernel source tree
91
92
93
94Linux man-pages 6.04              2023-03-30                  migrate_pages(2)
Impressum