Blame move_pages.2

Packit Service db5786
.\" Hey Emacs! This file is -*- nroff -*- source.
Packit Service db5786
.\"
Packit Service db5786
.\" This manpage is Copyright (C) 2006 Silicon Graphics, Inc.
Packit Service db5786
.\"                               Christoph Lameter
Packit Service db5786
.\"
Packit Service db5786
.\" Permission is granted to make and distribute verbatim copies of this
Packit Service db5786
.\" manual provided the copyright notice and this permission notice are
Packit Service db5786
.\" preserved on all copies.
Packit Service db5786
.\"
Packit Service db5786
.\" Permission is granted to copy and distribute modified versions of this
Packit Service db5786
.\" manual under the conditions for verbatim copying, provided that the
Packit Service db5786
.\" entire resulting derived work is distributed under the terms of a
Packit Service db5786
.\" permission notice identical to this one.
Packit Service db5786
.\"
Packit Service db5786
.TH MOVE_PAGES 2 2006-10-31 "Linux 2.6.18" "Linux Programmer's Manual"
Packit Service db5786
.SH NAME
Packit Service db5786
move_pages \- Move individual pages of a process to another node
Packit Service db5786
.SH SYNOPSIS
Packit Service db5786
.B #include <numaif.h>
Packit Service db5786
.sp
Packit Service db5786
.BI "long move_pages(int " pid ", unsigned long count, void ** " pages ", const int * " nodes ", int * " status ", int " flags );
Packit Service db5786
.SH DESCRIPTION
Packit Service db5786
.BR move_pages ()
Packit Service db5786
moves
Packit Service db5786
.I count
Packit Service db5786
pages to the
Packit Service db5786
.I nodes.
Packit Service db5786
The result of the move is reflected in
Packit Service db5786
.I status.
Packit Service db5786
The
Packit Service db5786
.I flags
Packit Service db5786
indicate constraints on the pages to be moved.
Packit Service db5786
Packit Service db5786
.I pid
Packit Service db5786
is the process id in which pages are to be moved. Sufficient rights
Packit Service db5786
must exist to move pages of another process. This means the moving
Packit Service db5786
process either has root priviledges, has SYS_NICE administrative rights or
Packit Service db5786
the same owner. If pid is 0 then we move pages of the current process.
Packit Service db5786
Packit Service db5786
.I count
Packit Service db5786
is the number of pages to move. It defines the size of the three
Packit Service db5786
arrays
Packit Service db5786
.I pages,
Packit Service db5786
.I nodes
Packit Service db5786
and
Packit Service db5786
.I status.
Packit Service db5786
Packit Service db5786
.I pages
Packit Service db5786
is an array of pointers to the pages that should be moved. These are pointers
Packit Service db5786
that should be aligned to page boundaries. Addresses are specified as seen by
Packit Service db5786
the process specified by
Packit Service db5786
.I pid.
Packit Service db5786
Packit Service db5786
.I nodes
Packit Service db5786
is either an array of integers that specify the desired location for each
Packit Service db5786
page or it is NULL. Each integer is a node number. If NULL is specified then
Packit Service db5786
move_pages will not move any pages but return the node of each page in
Packit Service db5786
the
Packit Service db5786
.I status
Packit Service db5786
array. Having the status of each page may be necessary to determine
Packit Service db5786
pages that need to be moved.
Packit Service db5786
Packit Service db5786
.I status
Packit Service db5786
is an array of integers that return the status of each page. The array
Packit Service db5786
only contains valid values if
Packit Service db5786
.I move_pages
Packit Service db5786
did not return an error code.
Packit Service db5786
Packit Service db5786
.I flags
Packit Service db5786
specify what types of pages to move.
Packit Service db5786
.B MPOL_MF_MOVE
Packit Service db5786
means that only pages that are in exclusive use by the process
Packit Service db5786
are to be moved.
Packit Service db5786
.B MPOL_MF_MOVE_ALL
Packit Service db5786
means that pages shared between multiple processes can also be moved.
Packit Service db5786
The process must have root priviledges or SYS_NICE priviledges.
Packit Service db5786
Packit Service db5786
.SH Page states in the status array
Packit Service db5786
Packit Service db5786
.TP
Packit Service db5786
.B 0..MAX_NUMNODES
Packit Service db5786
Indicates that the location of the page is on this node.
Packit Service db5786
.TP
Packit Service db5786
.B -ENOENT
Packit Service db5786
The page is not present.
Packit Service db5786
.TP
Packit Service db5786
.B -EACCES
Packit Service db5786
The page is mapped by multiple processes and can only be moved
Packit Service db5786
if
Packit Service db5786
.I MPOL_MF_MOVE_ALL
Packit Service db5786
is specified.
Packit Service db5786
.TP
Packit Service db5786
.B -EBUSY
Packit Service db5786
The page is currently busy and cannot be moved. Try again later.
Packit Service db5786
This occurs if a page is undergoing I/O or another kernel subsystem
Packit Service db5786
is holding a reference to the page.
Packit Service db5786
.TP
Packit Service db5786
.B -EFAULT
Packit Service db5786
This is a zero page or the memory area is not mapped by the process.
Packit Service db5786
.TP
Packit Service db5786
.B -ENOMEM
Packit Service db5786
Unable to allocate memory on target node.
Packit Service db5786
.TP
Packit Service db5786
.B -EIO
Packit Service db5786
Unable to write back a page. The page has to be written back
Packit Service db5786
in order to move ti since the page is dirty and the filesystem
Packit Service db5786
has not provide a migration function that would allow the move
Packit Service db5786
of dirty pages.
Packit Service db5786
.TP
Packit Service db5786
.B -EINVAL
Packit Service db5786
A dirty page cannot be moved. The filesystem does not
Packit Service db5786
provide a migration function and has no ability to write back pages.
Packit Service db5786
Packit Service db5786
.SH "RETURN VALUE"
Packit Service db5786
On success
Packit Service db5786
.B move_pages
Packit Service db5786
returns zero.
Packit Service db5786
.SH ERRORS
Packit Service db5786
.TP
Packit Service db5786
.B -ENOENT
Packit Service db5786
No pages were found that require moving. All pages are either already
Packit Service db5786
on the target node, not present, had an invalid address or could not be
Packit Service db5786
moved because they were mapped by multiple processes.
Packit Service db5786
.TP
Packit Service db5786
.B -EINVAL
Packit Service db5786
Flags other than
Packit Service db5786
.I MPOL_MF_MOVE
Packit Service db5786
and
Packit Service db5786
.I MPOL_MF_MOVE_ALL
Packit Service db5786
was specified or an attempt was made to migrate pages of a kernel thread.
Packit Service db5786
.TP
Packit Service db5786
.B -EPERM
Packit Service db5786
.I MPOL_MF_MOVE_ALL
Packit Service db5786
specified without sufficient privileges or an attempt to move a process
Packit Service db5786
belonging to another user.
Packit Service db5786
.TP
Packit Service db5786
.B -EACCESS
Packit Service db5786
On of the target nodes is not allowed by the current cpuset.
Packit Service db5786
.TP
Packit Service db5786
.B -ENODEV
Packit Service db5786
On of the target nodes is not online.
Packit Service db5786
.TP
Packit Service db5786
.B -ESRCH
Packit Service db5786
Process does not exist.
Packit Service db5786
.TP
Packit Service db5786
.B -E2BIG
Packit Service db5786
Too many pages to move.
Packit Service db5786
.TP
Packit Service db5786
.B -EFAULT
Packit Service db5786
Parameter array could not be accessed.
Packit Service db5786
.SH "SEE ALSO"
Packit Service db5786
.BR numa_maps (5),
Packit Service db5786
.BR migratepages (8),
Packit Service db5786
.BR numa_stat (8),
Packit Service db5786
.BR numa (3)