]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man2/move_pages.2
get_mempolicy.2, mbind.2, set_mempolicy.2: Added LICENSE_START(VERBATIM_PROF)
[thirdparty/man-pages.git] / man2 / move_pages.2
CommitLineData
abe7c871
MK
1.\" This manpage is Copyright (C) 2006 Silicon Graphics, Inc.
2.\" Christoph Lameter
3.\"
4.\" Permission is granted to make and distribute verbatim copies of this
5.\" manual provided the copyright notice and this permission notice are
6.\" preserved on all copies.
7.\"
8.\" Permission is granted to copy and distribute modified versions of this
9.\" manual under the conditions for verbatim copying, provided that the
10.\" entire resulting derived work is distributed under the terms of a
11.\" permission notice identical to this one.
12.\"
13.\" FIXME Should programs normally be using this API directly, or should
14.\" they rather be using interfaces in the numactl package?
15.\" (e.g., compare with recommendation in mbind(2)).
1fd0fa43 16.TH MOVE_PAGES 2 2010-06-11 "Linux" "Linux Programmer's Manual"
abe7c871
MK
17.SH NAME
18move_pages \- move individual pages of a process to another node
19.SH SYNOPSIS
20.nf
21.B #include <numaif.h>
22.sp
23.BI "long move_pages(int " pid ", unsigned long count, void **" pages ,
24.BI " const int *" nodes ", int *" status ", int " flags );
25.fi
cb8fbbcd
AK
26.sp
27Link with \fI\-lnuma\fP.
abe7c871
MK
28.SH DESCRIPTION
29.BR move_pages ()
30moves the specified
31.I pages
32of the process
33.I pid
34to the memory nodes specified by
35.IR nodes .
36The result of the move is reflected in
37.IR status .
38The
39.I flags
40indicate constraints on the pages to be moved.
41
42.I pid
43is the ID of the process in which pages are to be moved.
44To move pages in another process,
45the caller must be privileged
46.RB ( CAP_SYS_NICE )
47or the real or effective user ID of the calling process must match the
48real or saved-set user ID of the target process.
49If
50.I pid
81fff50b 51is 0, then
abe7c871
MK
52.BR move_pages ()
53moves pages of the calling process.
54
55.I count
56is the number of pages to move.
57It defines the size of the three arrays
58.IR pages ,
59.IR nodes ,
60and
61.IR status .
62
63.I pages
64is an array of pointers to the pages that should be moved.
65These are pointers that should be aligned to page boundaries.
66.\" FIXME what if they are not aligned?
67Addresses are specified as seen by the process specified by
68.IR pid .
69
70.I nodes
71is an array of integers that specify the desired location for each page.
72Each element in the array is a node number.
73.I nodes
74can also be NULL, in which case
75.BR move_pages ()
76does not move any pages but instead will return the node
77where each page currently resides, in the
78.I status
79array.
80Obtaining the status of each page may be necessary to determine
81pages that need to be moved.
82
83.I status
84is an array of integers that return the status of each page.
85The array only contains valid values if
86.BR move_pages ()
87did not return an error.
88
89.I flags
90specify what types of pages to move.
91.B MPOL_MF_MOVE
92means that only pages that are in exclusive use by the process
93are to be moved.
94.B MPOL_MF_MOVE_ALL
95means that pages shared between multiple processes can also be moved.
96The process must be privileged
97.RB ( CAP_SYS_NICE )
98to use
99.BR MPOL_MF_MOVE_ALL .
100.SH Page states in the status array
101The following values can be returned in each element of the
102.I status
103array.
104.TP
105.B 0..MAX_NUMNODES
106Identifies the node on which the page resides.
107.TP
108.B -EACCES
109The page is mapped by multiple processes and can only be moved if
110.B MPOL_MF_MOVE_ALL
111is specified.
112.TP
113.B -EBUSY
114The page is currently busy and cannot be moved.
115Try again later.
116This occurs if a page is undergoing I/O or another kernel subsystem
117is holding a reference to the page.
118.TP
119.B -EFAULT
120This is a zero page or the memory area is not mapped by the process.
121.TP
122.B -EIO
123Unable to write back a page.
124The page has to be written back
e21a7c25 125in order to move it since the page is dirty and the file system
abe7c871
MK
126does not provide a migration function that would allow the move
127of dirty pages.
128.TP
129.B -EINVAL
130A dirty page cannot be moved.
e21a7c25 131The file system does not
abe7c871
MK
132provide a migration function and has no ability to write back pages.
133.TP
134.B -ENOENT
135The page is not present.
136.TP
137.B -ENOMEM
138Unable to allocate memory on target node.
47297adb 139.SH RETURN VALUE
abe7c871
MK
140On success
141.BR move_pages ()
142returns zero.
143.\" FIXME Is the following quite true: does the wrapper in numactl
144.\" do the right thing?
145On error, it returns \-1, and sets
146.I errno
147to indicate the error.
148.SH ERRORS
149.TP
150.B E2BIG
151Too many pages to move.
152.TP