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() moves all pages of the process pid that are in memory
19 nodes old_nodes to the memory nodes in new_nodes. Pages not located in
20 any node in old_nodes will not be migrated. As far as possible, the
21 kernel maintains the relative topology relationship inside old_nodes
22 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 only be moved if the initiating
38 process has the CAP_SYS_NICE privilege.
39
41 On success migrate_pages() returns zero. On error, it returns -1, and
42 sets errno to indicate the error.
43
45 EPERM Insufficient privilege (CAP_SYS_NICE) to move pages of the
46 process specified by pid, or insufficient privilege
47 (CAP_SYS_NICE) to access the specified target nodes.
48
49 ESRCH No process matching pid could be found.
50
52 The migrate_pages() system call first appeared on Linux in version
53 2.6.16.
54
56 This system call is Linux-specific.
57
59 For information on library support, see numa(7).
60
61 Use get_mempolicy(2) with the MPOL_F_MEMS_ALLOWED flag to obtain the
62 set of nodes that are allowed by the calling process's cpuset. Note
63 that this information is subject to change at any time by manual or
64 automatic reconfiguration of the cpuset.
65
66 Use of migrate_pages() may result in pages whose location (node) vio‐
67 lates the memory policy established for the specified addresses (see
68 mbind(2)) and/or the specified process (see set_mempolicy(2)). That
69 is, memory policy does not constrain the destination nodes used by
70 migrate_pages().
71
72 The <numaif.h> header is not included with glibc, but requires
73 installing libnuma-devel or a similar package.
74
76 get_mempolicy(2), mbind(2), set_mempolicy(2), numa(3), numa_maps(5),
77 cpuset(7), numa(7), migratepages(8), numa_stat(8)
78
80 This page is part of release 3.25 of the Linux man-pages project. A
81 description of the project, and information about reporting bugs, can
82 be found at http://www.kernel.org/doc/man-pages/.
83
84
85
86Linux 2010-06-11 MIGRATE_PAGES(2)