1MIGRATE_PAGES(2) Linux Programmer's Manual MIGRATE_PAGES(2)
2
3
4
6 migrate_pages - move all pages in a process to another set of nodes
7
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 Link with -lnuma.
16
18 migrate_pages() attempts to move all pages of the process pid that are
19 in memory nodes old_nodes to the memory nodes in new_nodes. Pages not
20 located in any node in old_nodes will not be migrated. As far as pos‐
21 sible, the kernel maintains the relative topology relationship inside
22 old_nodes during the migration to new_nodes.
23
24 The old_nodes and new_nodes arguments are pointers to bit masks of node
25 numbers, with up to maxnode bits in each mask. These masks are main‐
26 tained as arrays of unsigned long integers (in the last long integer,
27 the bits beyond those specified by maxnode are ignored). The maxnode
28 argument is the maximum node number in the bit mask plus one (this is
29 the same as in mbind(2), but different from select(2)).
30
31 The pid argument is the ID of the process whose pages are to be moved.
32 To move pages in another process, the caller must be privileged
33 (CAP_SYS_NICE) or the real or effective user ID of the calling process
34 must match the real or saved-set user ID of the target process. If pid
35 is 0, then migrate_pages() moves pages of the calling process.
36
37 Pages shared with another process will be moved only if the initiating
38 process has the CAP_SYS_NICE privilege.
39
41 On success migrate_pages() returns the number of pages that could not
42 be moved (i.e., a return of zero means that all pages were successfully
43 moved). On error, it returns -1, and sets errno to indicate the error.
44
46 EFAULT Part or all of the memory range specified by old_nodes/new_nodes
47 and maxnode points outside your accessible address space.
48
49 EINVAL The value specified by maxnode exceeds a kernel-imposed limit.
50 Or, old_nodes or new_nodes specifies one or more node IDs that
51 are greater than the maximum supported node ID. Or, none of the
52 node IDs specified by new_nodes are on-line and allowed by the
53 process's current cpuset context, or none of the specified nodes
54 contain memory.
55
56 EPERM Insufficient privilege (CAP_SYS_NICE) to move pages of the
57 process specified by pid, or insufficient privilege
58 (CAP_SYS_NICE) to access the specified target nodes.
59
60 ESRCH No process matching pid could be found.
61
63 The migrate_pages() system call first appeared on Linux in version
64 2.6.16.
65
67 This system call is Linux-specific.
68
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
75 automatic 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
81 migrate_pages().
82
83 The <numaif.h> header is not included with glibc, but requires
84 installing libnuma-devel or a similar package.
85
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 in the Linux kernel source tree
91
93 This page is part of release 4.15 of the Linux man-pages project. A
94 description of the project, information about reporting bugs, and the
95 latest version of this page, can be found at
96 https://www.kernel.org/doc/man-pages/.
97
98
99
100Linux 2017-09-15 MIGRATE_PAGES(2)