296 lines
6.4 KiB
HTML
296 lines
6.4 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of MIGRATE_PAGES</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>MIGRATE_PAGES</H1>
|
|
Section: Linux Programmer's Manual (2)<BR>Updated: 2019-03-06<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
migrate_pages - move all pages in a process to another set of nodes
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<PRE>
|
|
<B>#include <<A HREF="file:///usr/include/numaif.h">numaif.h</A>></B>
|
|
|
|
<B>long migrate_pages(int </B><I>pid</I><B>, unsigned long </B><I>maxnode,</I>
|
|
<B> const unsigned long *</B><I>old_nodes,</I>
|
|
<B> const unsigned long *</B><I>new_nodes</I><B>);</B>
|
|
</PRE>
|
|
|
|
<P>
|
|
|
|
Link with <I>-lnuma</I>.
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
<B>migrate_pages</B>()
|
|
|
|
attempts to move all pages of the process
|
|
<I>pid</I>
|
|
|
|
that are in memory nodes
|
|
<I>old_nodes</I>
|
|
|
|
to the memory nodes in
|
|
<I>new_nodes</I>.
|
|
|
|
Pages not located in any node in
|
|
<I>old_nodes</I>
|
|
|
|
will not be migrated.
|
|
As far as possible,
|
|
the kernel maintains the relative topology relationship inside
|
|
<I>old_nodes</I>
|
|
|
|
during the migration to
|
|
<I>new_nodes</I>.
|
|
|
|
<P>
|
|
|
|
The
|
|
<I>old_nodes</I>
|
|
|
|
and
|
|
<I>new_nodes</I>
|
|
|
|
arguments are pointers to bit masks of node numbers, with up to
|
|
<I>maxnode</I>
|
|
|
|
bits in each mask.
|
|
These masks are maintained as arrays of unsigned
|
|
<I>long</I>
|
|
|
|
integers (in the last
|
|
<I>long</I>
|
|
|
|
integer, the bits beyond those specified by
|
|
<I>maxnode</I>
|
|
|
|
are ignored).
|
|
The
|
|
<I>maxnode</I>
|
|
|
|
argument is the maximum node number in the bit mask plus one (this is the same
|
|
as in
|
|
<B><A HREF="/cgi-bin/man/man2html?2+mbind">mbind</A></B>(2),
|
|
|
|
but different from
|
|
<B><A HREF="/cgi-bin/man/man2html?2+select">select</A></B>(2)).
|
|
|
|
<P>
|
|
|
|
The
|
|
<I>pid</I>
|
|
|
|
argument is the ID of the process whose pages are to be moved.
|
|
To move pages in another process,
|
|
the caller must be privileged
|
|
(<B>CAP_SYS_NICE</B>)
|
|
|
|
or the real or effective user ID of the calling process must match the
|
|
real or saved-set user ID of the target process.
|
|
If
|
|
<I>pid</I>
|
|
|
|
is 0, then
|
|
<B>migrate_pages</B>()
|
|
|
|
moves pages of the calling process.
|
|
<P>
|
|
|
|
Pages shared with another process will be moved only if the initiating
|
|
process has the
|
|
<B>CAP_SYS_NICE</B>
|
|
|
|
privilege.
|
|
<A NAME="lbAE"> </A>
|
|
<H2>RETURN VALUE</H2>
|
|
|
|
On success
|
|
<B>migrate_pages</B>()
|
|
|
|
returns the number of pages that could not be moved
|
|
(i.e., a return of zero means that all pages were successfully moved).
|
|
On error, it returns -1, and sets
|
|
<I>errno</I>
|
|
|
|
to indicate the error.
|
|
<A NAME="lbAF"> </A>
|
|
<H2>ERRORS</H2>
|
|
|
|
<DL COMPACT>
|
|
<DT id="1"><B>EFAULT</B>
|
|
|
|
<DD>
|
|
Part or all of the memory range specified by
|
|
<I>old_nodes</I>/<I>new_nodes</I>
|
|
|
|
and
|
|
<I>maxnode</I>
|
|
|
|
points outside your accessible address space.
|
|
<DT id="2"><B>EINVAL</B>
|
|
|
|
<DD>
|
|
The value specified by
|
|
<I>maxnode</I>
|
|
|
|
exceeds a kernel-imposed limit.
|
|
|
|
|
|
Or,
|
|
<I>old_nodes</I>
|
|
|
|
or
|
|
<I>new_nodes</I>
|
|
|
|
specifies one or more node IDs that are
|
|
greater than the maximum supported node ID.
|
|
Or, none of the node IDs specified by
|
|
<I>new_nodes</I>
|
|
|
|
are on-line and allowed by the process's current cpuset context,
|
|
or none of the specified nodes contain memory.
|
|
<DT id="3"><B>EPERM</B>
|
|
|
|
<DD>
|
|
Insufficient privilege
|
|
(<B>CAP_SYS_NICE</B>)
|
|
|
|
to move pages of the process specified by
|
|
<I>pid</I>,
|
|
|
|
or insufficient privilege
|
|
(<B>CAP_SYS_NICE</B>)
|
|
|
|
to access the specified target nodes.
|
|
<DT id="4"><B>ESRCH</B>
|
|
|
|
<DD>
|
|
No process matching
|
|
<I>pid</I>
|
|
|
|
could be found.
|
|
|
|
</DL>
|
|
<A NAME="lbAG"> </A>
|
|
<H2>VERSIONS</H2>
|
|
|
|
The
|
|
<B>migrate_pages</B>()
|
|
|
|
system call first appeared on Linux in version 2.6.16.
|
|
<A NAME="lbAH"> </A>
|
|
<H2>CONFORMING TO</H2>
|
|
|
|
This system call is Linux-specific.
|
|
<A NAME="lbAI"> </A>
|
|
<H2>NOTES</H2>
|
|
|
|
For information on library support, see
|
|
<B><A HREF="/cgi-bin/man/man2html?7+numa">numa</A></B>(7).
|
|
|
|
<P>
|
|
|
|
Use
|
|
<B><A HREF="/cgi-bin/man/man2html?2+get_mempolicy">get_mempolicy</A></B>(2)
|
|
|
|
with the
|
|
<B>MPOL_F_MEMS_ALLOWED</B>
|
|
|
|
flag to obtain the set of nodes that are allowed by
|
|
the calling process's cpuset.
|
|
Note that this information is subject to change at any
|
|
time by manual or automatic reconfiguration of the cpuset.
|
|
<P>
|
|
|
|
Use of
|
|
<B>migrate_pages</B>()
|
|
|
|
may result in pages whose location
|
|
(node) violates the memory policy established for the
|
|
specified addresses (see
|
|
<B><A HREF="/cgi-bin/man/man2html?2+mbind">mbind</A></B>(2))
|
|
|
|
and/or the specified process (see
|
|
<B><A HREF="/cgi-bin/man/man2html?2+set_mempolicy">set_mempolicy</A></B>(2)).
|
|
|
|
That is, memory policy does not constrain the destination
|
|
nodes used by
|
|
<B>migrate_pages</B>().
|
|
|
|
<P>
|
|
|
|
The
|
|
<I><<A HREF="file:///usr/include/numaif.h">numaif.h</A>></I>
|
|
|
|
header is not included with glibc, but requires installing
|
|
<I>libnuma-devel</I>
|
|
|
|
or a similar package.
|
|
<A NAME="lbAJ"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+get_mempolicy">get_mempolicy</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+mbind">mbind</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+set_mempolicy">set_mempolicy</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+numa">numa</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?5+numa_maps">numa_maps</A></B>(5),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?7+cpuset">cpuset</A></B>(7),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?7+numa">numa</A></B>(7),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?8+migratepages">migratepages</A></B>(8),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?8+numastat">numastat</A></B>(8)
|
|
|
|
<P>
|
|
|
|
<I>Documentation/vm/page_migration.rst</I>
|
|
|
|
in the Linux kernel source tree
|
|
<A NAME="lbAK"> </A>
|
|
<H2>COLOPHON</H2>
|
|
|
|
This page is part of release 5.05 of the Linux
|
|
<I>man-pages</I>
|
|
|
|
project.
|
|
A description of the project,
|
|
information about reporting bugs,
|
|
and the latest version of this page,
|
|
can be found at
|
|
<A HREF="https://www.kernel.org/doc/man-pages/.">https://www.kernel.org/doc/man-pages/.</A>
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="5"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="6"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="7"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="8"><A HREF="#lbAE">RETURN VALUE</A><DD>
|
|
<DT id="9"><A HREF="#lbAF">ERRORS</A><DD>
|
|
<DT id="10"><A HREF="#lbAG">VERSIONS</A><DD>
|
|
<DT id="11"><A HREF="#lbAH">CONFORMING TO</A><DD>
|
|
<DT id="12"><A HREF="#lbAI">NOTES</A><DD>
|
|
<DT id="13"><A HREF="#lbAJ">SEE ALSO</A><DD>
|
|
<DT id="14"><A HREF="#lbAK">COLOPHON</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:33 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|