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