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 EPERM Insufficient privilege (CAP_SYS_NICE) to move pages of the
47 process specified by pid, or insufficient privilege
48 (CAP_SYS_NICE) to access the specified target nodes.
49
50 ESRCH No process matching pid could be found.
51
53 The migrate_pages() system call first appeared on Linux in version
54 2.6.16.
55
57 This system call is Linux-specific.
58
60 For information on library support, see numa(7).
61
62 Use get_mempolicy(2) with the MPOL_F_MEMS_ALLOWED flag to obtain the
63 set of nodes that are allowed by the calling process's cpuset. Note
64 that this information is subject to change at any time by manual or
65 automatic reconfiguration of the cpuset.
66
67 Use of migrate_pages() may result in pages whose location (node) vio‐
68 lates the memory policy established for the specified addresses (see
69 mbind(2)) and/or the specified process (see set_mempolicy(2)). That
70 is, memory policy does not constrain the destination nodes used by
71 migrate_pages().
72
73 The <numaif.h> header is not included with glibc, but requires
74 installing libnuma-devel or a similar package.
75
77 get_mempolicy(2), mbind(2), set_mempolicy(2), numa(3), numa_maps(5),
78 cpuset(7), numa(7), migratepages(8), numastat(8)
79
80 Documentation/vm/page_migration in the Linux kernel source tree
81
83 This page is part of release 3.53 of the Linux man-pages project. A
84 description of the project, and information about reporting bugs, can
85 be found at http://www.kernel.org/doc/man-pages/.
86
87
88
89Linux 2012-08-01 MIGRATE_PAGES(2)