1 .\" Copyright 2009 Intel Corporation
3 .\" Based on the move_pages manpage which was
4 .\" This manpage is Copyright (C) 2006 Silicon Graphics, Inc.
7 .\" %%%LICENSE_START(VERBATIM_TWO_PARA)
8 .\" Permission is granted to make and distribute verbatim copies of this
9 .\" manual provided the copyright notice and this permission notice are
10 .\" preserved on all copies.
12 .\" Permission is granted to copy and distribute modified versions of this
13 .\" manual under the conditions for verbatim copying, provided that the
14 .\" entire resulting derived work is distributed under the terms of a
15 .\" permission notice identical to this one.
18 .TH MIGRATE_PAGES 2 2022-09-09 "Linux man-pages (unreleased)"
20 migrate_pages \- move all pages in a process to another set of nodes
22 NUMA (Non-Uniform Memory Access) policy library
23 .RI ( libnuma ", " \-lnuma )
26 .B #include <numaif.h>
28 .BI "long migrate_pages(int " pid ", unsigned long " maxnode,
29 .BI " const unsigned long *" old_nodes,
30 .BI " const unsigned long *" new_nodes );
34 attempts to move all pages of the process
36 that are in memory nodes
38 to the memory nodes in
40 Pages not located in any node in
44 the kernel maintains the relative topology relationship inside
46 during the migration to
53 arguments are pointers to bit masks of node numbers, with up to
56 These masks are maintained as arrays of unsigned
60 integer, the bits beyond those specified by
65 argument is the maximum node number in the bit mask plus one (this is the same
73 argument is the ID of the process whose pages are to be moved.
74 To move pages in another process,
75 the caller must be privileged
77 or the real or effective user ID of the calling process must match the
78 real or saved-set user ID of the target process.
83 moves pages of the calling process.
85 Pages shared with another process will be moved only if the initiating
92 returns the number of pages that could not be moved
93 (i.e., a return of zero means that all pages were successfully moved).
94 On error, it returns \-1, and sets
96 to indicate the error.
100 Part or all of the memory range specified by
101 .IR old_nodes / new_nodes
104 points outside your accessible address space.
107 The value specified by
109 exceeds a kernel-imposed limit.
110 .\" As at 3.5, this limit is "a page worth of bits", e.g.,
111 .\" 8 * 4096 bits, assuming a 4kB page size.
116 specifies one or more node IDs that are
117 greater than the maximum supported node ID.
118 Or, none of the node IDs specified by
120 are on-line and allowed by the process's current cpuset context,
121 or none of the specified nodes contain memory.
124 Insufficient privilege
126 to move pages of the process specified by
128 or insufficient privilege
130 to access the specified target nodes.
136 .\" FIXME Document the other errors that can occur for migrate_pages()
140 system call first appeared on Linux in version 2.6.16.
142 This system call is Linux-specific.
144 For information on library support, see
148 .BR get_mempolicy (2)
150 .B MPOL_F_MEMS_ALLOWED
151 flag to obtain the set of nodes that are allowed by
152 the calling process's cpuset.
153 Note that this information is subject to change at any
154 time by manual or automatic reconfiguration of the cpuset.
158 may result in pages whose location
159 (node) violates the memory policy established for the
160 specified addresses (see
162 and/or the specified process (see
163 .BR set_mempolicy (2)).
164 That is, memory policy does not constrain the destination
166 .BR migrate_pages ().
170 header is not included with glibc, but requires installing
172 or a similar package.
174 .BR get_mempolicy (2),
176 .BR set_mempolicy (2),
181 .BR migratepages (8),
184 .I Documentation/vm/page_migration.rst
185 in the Linux kernel source tree