2006-02-08 03:20:44 +00:00
|
|
|
.\" Copyright 2003,2004 Andi Kleen, SuSE Labs.
|
2007-08-27 11:09:06 +00:00
|
|
|
.\" and Copyright 2007 Lee Schermerhorn, Hewlett Packard
|
2006-02-08 03:20:44 +00:00
|
|
|
.\"
|
2013-03-10 09:29:06 +00:00
|
|
|
.\" %%%LICENSE_START(VERBATIM_PROF)
|
2006-02-08 03:20:44 +00:00
|
|
|
.\" Permission is granted to make and distribute verbatim copies of this
|
|
|
|
.\" manual provided the copyright notice and this permission notice are
|
|
|
|
.\" preserved on all copies.
|
|
|
|
.\"
|
|
|
|
.\" Permission is granted to copy and distribute modified versions of this
|
|
|
|
.\" manual under the conditions for verbatim copying, provided that the
|
|
|
|
.\" entire resulting derived work is distributed under the terms of a
|
|
|
|
.\" permission notice identical to this one.
|
2007-04-12 22:42:49 +00:00
|
|
|
.\"
|
2006-02-08 03:20:44 +00:00
|
|
|
.\" Since the Linux kernel and libraries are constantly changing, this
|
|
|
|
.\" manual page may be incorrect or out-of-date. The author(s) assume no
|
|
|
|
.\" responsibility for errors or omissions, or for damages resulting from
|
2007-04-12 22:42:49 +00:00
|
|
|
.\" the use of the information contained herein.
|
|
|
|
.\"
|
2006-02-08 03:20:44 +00:00
|
|
|
.\" Formatted or processed versions of this manual, if unaccompanied by
|
|
|
|
.\" the source, must acknowledge the copyright and authors of this work.
|
2013-03-10 09:29:06 +00:00
|
|
|
.\" %%%LICENSE_END
|
2007-04-12 22:42:49 +00:00
|
|
|
.\"
|
2006-02-08 03:20:44 +00:00
|
|
|
.\" 2006-02-03, mtk, substantial wording changes and other improvements
|
2007-08-27 11:09:06 +00:00
|
|
|
.\" 2007-08-27, Lee Schermerhorn <Lee.Schermerhorn@hp.com>
|
|
|
|
.\" more precise specification of behavior.
|
2006-02-08 03:20:44 +00:00
|
|
|
.\"
|
2008-08-13 08:19:47 +00:00
|
|
|
.TH GET_MEMPOLICY 2 2008-08-15 Linux "Linux Programmer's Manual"
|
2006-02-08 03:20:44 +00:00
|
|
|
.SH NAME
|
intro.1, add_key.2, get_mempolicy.2, get_thread_area.2, intro.2, keyctl.2, mbind.2, request_key.2, set_thread_area.2, clock.3, cmsg.3, getcwd.3, getpw.3, intro.3, malloc.3, posix_memalign.3, shm_open.3, sleep.3, sysconf.3, intro.4, sd.4, intro.5, locale.5, slabinfo.5, intro.6, boot.7, bootparam.7, futex.7, glob.7, hier.7, intro.7, libc.7, locale.7, mq_overview.7, netlink.7, sem_overview.7, shm_overview.7, unix.7, intro.8: Global fix: Use consistent capitalization in NAME section
The line(s) in the NAME section should only use capitals
where English usage dictates that. Otherwise, use
lowercase throughout.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2012-10-21 06:29:13 +00:00
|
|
|
get_mempolicy \- retrieve NUMA memory policy for a process
|
2007-05-18 11:01:49 +00:00
|
|
|
.SH SYNOPSIS
|
2007-04-12 22:42:49 +00:00
|
|
|
.B "#include <numaif.h>"
|
2006-08-04 09:41:28 +00:00
|
|
|
.nf
|
2006-02-08 03:20:44 +00:00
|
|
|
.sp
|
2007-08-27 11:09:06 +00:00
|
|
|
.BI "int get_mempolicy(int *" mode ", unsigned long *" nodemask ,
|
2007-04-12 22:42:49 +00:00
|
|
|
.BI " unsigned long " maxnode ", unsigned long " addr ,
|
2006-08-04 09:41:28 +00:00
|
|
|
.BI " unsigned long " flags );
|
2007-08-27 11:09:06 +00:00
|
|
|
.sp
|
2009-02-23 18:40:41 +00:00
|
|
|
Link with \fI\-lnuma\fP.
|
2006-08-04 09:41:28 +00:00
|
|
|
.fi
|
2006-02-08 03:20:44 +00:00
|
|
|
.SH DESCRIPTION
|
|
|
|
.BR get_mempolicy ()
|
|
|
|
retrieves the NUMA policy of the calling process or of a memory address,
|
|
|
|
depending on the setting of
|
|
|
|
.IR flags .
|
|
|
|
|
|
|
|
A NUMA machine has different
|
|
|
|
memory controllers with different distances to specific CPUs.
|
2007-08-27 11:09:06 +00:00
|
|
|
The memory policy defines from which node memory is allocated for
|
2007-04-12 22:42:49 +00:00
|
|
|
the process.
|
2006-02-08 03:20:44 +00:00
|
|
|
|
|
|
|
If
|
2007-09-20 16:26:31 +00:00
|
|
|
.I flags
|
2006-02-08 03:20:44 +00:00
|
|
|
is specified as 0,
|
2007-04-12 22:42:49 +00:00
|
|
|
then information about the calling process's default policy
|
2006-02-08 03:20:44 +00:00
|
|
|
(as set by
|
|
|
|
.BR set_mempolicy (2))
|
|
|
|
is returned.
|
2008-08-08 19:47:20 +00:00
|
|
|
The policy returned
|
|
|
|
.RI [ mode
|
|
|
|
and
|
|
|
|
.IR nodemask ]
|
|
|
|
may be used to restore the process's policy to its state at
|
|
|
|
the time of the call to
|
|
|
|
.BR get_mempolicy ()
|
|
|
|
using
|
|
|
|
.BR set_mempolicy (2).
|
2006-02-08 03:20:44 +00:00
|
|
|
|
2008-08-08 20:02:56 +00:00
|
|
|
If
|
|
|
|
.I flags
|
|
|
|
specifies
|
2008-08-12 10:27:05 +00:00
|
|
|
.BR MPOL_F_MEMS_ALLOWED
|
2008-08-08 20:02:56 +00:00
|
|
|
(available since Linux 2.6.24), the
|
|
|
|
.I mode
|
|
|
|
argument is ignored and the set of nodes [memories] that the
|
|
|
|
process is allowed to specify in subsequent calls to
|
|
|
|
.BR mbind (2)
|
|
|
|
or
|
|
|
|
.BR set_mempolicy (2)
|
2011-09-14 06:03:06 +00:00
|
|
|
[in the absence of any
|
2008-08-08 20:02:56 +00:00
|
|
|
.IR "mode flags" ]
|
|
|
|
is returned in
|
|
|
|
.IR nodemask .
|
|
|
|
It is not permitted to combine
|
|
|
|
.B MPOL_F_MEMS_ALLOWED
|
|
|
|
with either
|
|
|
|
.B MPOL_F_ADDR
|
|
|
|
or
|
|
|
|
.BR MPOL_F_NODE .
|
|
|
|
|
2007-04-12 22:42:49 +00:00
|
|
|
If
|
2006-02-08 03:20:44 +00:00
|
|
|
.I flags
|
|
|
|
specifies
|
|
|
|
.BR MPOL_F_ADDR ,
|
|
|
|
then information is returned about the policy governing the memory
|
|
|
|
address given in
|
|
|
|
.IR addr .
|
|
|
|
This policy may be different from the process's default policy if
|
2007-08-27 11:09:06 +00:00
|
|
|
.BR mbind (2)
|
|
|
|
or one of the helper functions described in
|
2007-08-27 11:34:07 +00:00
|
|
|
.BR numa (3)
|
2007-08-27 11:09:06 +00:00
|
|
|
has been used to establish a policy for the memory range containing
|
2006-02-08 03:20:44 +00:00
|
|
|
.IR addr .
|
|
|
|
|
2007-08-27 11:09:06 +00:00
|
|
|
If the
|
|
|
|
.I mode
|
|
|
|
argument is not NULL, then
|
2007-12-20 11:25:58 +00:00
|
|
|
.BR get_mempolicy ()
|
2008-08-08 19:47:20 +00:00
|
|
|
will store the policy mode and any optional
|
|
|
|
.I "mode flags"
|
|
|
|
of the requested NUMA policy in the location pointed to by this argument.
|
2007-04-12 22:42:49 +00:00
|
|
|
If
|
2007-09-20 16:26:31 +00:00
|
|
|
.I nodemask
|
2007-08-27 11:09:06 +00:00
|
|
|
is not NULL, then the nodemask associated with the policy will be stored
|
|
|
|
in the location pointed to by this argument.
|
2007-04-12 22:42:49 +00:00
|
|
|
.I maxnode
|
2007-08-27 11:34:07 +00:00
|
|
|
specifies the number of node IDs
|
2007-08-27 11:09:06 +00:00
|
|
|
that can be stored into
|
|
|
|
.IR nodemask \(emthat
|
2007-08-27 11:34:07 +00:00
|
|
|
is, the maximum node ID plus one.
|
2007-08-27 11:09:06 +00:00
|
|
|
The value specified by
|
|
|
|
.I maxnode
|
|
|
|
is always rounded to a multiple of
|
|
|
|
.IR "sizeof(unsigned long)" .
|
|
|
|
|
|
|
|
If
|
|
|
|
.I flags
|
|
|
|
specifies both
|
|
|
|
.B MPOL_F_NODE
|
|
|
|
and
|
|
|
|
.BR MPOL_F_ADDR ,
|
2007-12-20 11:25:58 +00:00
|
|
|
.BR get_mempolicy ()
|
2007-08-27 11:34:07 +00:00
|
|
|
will return the node ID of the node on which the address
|
2007-08-27 11:09:06 +00:00
|
|
|
.I addr
|
|
|
|
is allocated into the location pointed to by
|
|
|
|
.IR mode .
|
|
|
|
If no page has yet been allocated for the specified address,
|
2007-12-20 11:25:58 +00:00
|
|
|
.BR get_mempolicy ()
|
2007-08-27 11:09:06 +00:00
|
|
|
will allocate a page as if the process had performed a read
|
2007-08-27 11:34:07 +00:00
|
|
|
[load] access to that address, and return the ID of the node
|
2007-08-27 11:09:06 +00:00
|
|
|
where that page was allocated.
|
|
|
|
|
|
|
|
If
|
|
|
|
.I flags
|
|
|
|
specifies
|
|
|
|
.BR MPOL_F_NODE ,
|
|
|
|
but not
|
|
|
|
.BR MPOL_F_ADDR ,
|
|
|
|
and the process's current policy is
|
|
|
|
.BR MPOL_INTERLEAVE ,
|
|
|
|
then
|
2007-12-20 11:25:58 +00:00
|
|
|
.BR get_mempolicy ()
|
2007-08-27 11:09:06 +00:00
|
|
|
will return in the location pointed to by a non-NULL
|
|
|
|
.I mode
|
|
|
|
argument,
|
2007-08-27 11:34:07 +00:00
|
|
|
the node ID of the next node that will be used for
|
2007-08-27 11:09:06 +00:00
|
|
|
interleaving of internal kernel pages allocated on behalf of the process.
|
2007-08-27 11:34:07 +00:00
|
|
|
.\" Note: code returns next interleave node via 'mode' argument -Lee Schermerhorn
|
2007-08-27 11:09:06 +00:00
|
|
|
These allocations include pages for memory mapped files in
|
|
|
|
process memory ranges mapped using the
|
2007-12-20 11:25:58 +00:00
|
|
|
.BR mmap (2)
|
2007-08-27 11:09:06 +00:00
|
|
|
call with the
|
2007-08-27 11:34:07 +00:00
|
|
|
.B MAP_PRIVATE
|
2007-08-27 11:09:06 +00:00
|
|
|
flag for read accesses, and in memory ranges mapped with the
|
2007-08-27 11:34:07 +00:00
|
|
|
.B MAP_SHARED
|
2007-08-27 11:09:06 +00:00
|
|
|
flag for all accesses.
|
|
|
|
|
|
|
|
Other flag values are reserved.
|
2006-02-08 03:20:44 +00:00
|
|
|
|
|
|
|
For an overview of the possible policies see
|
|
|
|
.BR set_mempolicy (2).
|
|
|
|
.SH RETURN VALUE
|
|
|
|
On success,
|
|
|
|
.BR get_mempolicy ()
|
|
|
|
returns 0;
|
|
|
|
on error, \-1 is returned and
|
2007-04-12 22:42:49 +00:00
|
|
|
.I errno
|
2006-02-08 03:20:44 +00:00
|
|
|
is set to indicate the error.
|
2007-08-27 11:09:06 +00:00
|
|
|
.SH ERRORS
|
|
|
|
.TP
|
2007-10-23 06:21:25 +00:00
|
|
|
.B EFAULT
|
|
|
|
Part of all of the memory range specified by
|
|
|
|
.I nodemask
|
|
|
|
and
|
|
|
|
.I maxnode
|
|
|
|
points outside your accessible address space.
|
|
|
|
.TP
|
2007-08-27 11:09:06 +00:00
|
|
|
.B EINVAL
|
|
|
|
The value specified by
|
|
|
|
.I maxnode
|
2007-08-27 11:34:07 +00:00
|
|
|
is less than the number of node IDs supported by the system.
|
2007-08-27 11:09:06 +00:00
|
|
|
Or
|
|
|
|
.I flags
|
|
|
|
specified values other than
|
|
|
|
.B MPOL_F_NODE
|
|
|
|
or
|
|
|
|
.BR MPOL_F_ADDR ;
|
|
|
|
or
|
|
|
|
.I flags
|
|
|
|
specified
|
|
|
|
.B MPOL_F_ADDR
|
|
|
|
and
|
|
|
|
.I addr
|
|
|
|
is NULL,
|
|
|
|
or
|
|
|
|
.I flags
|
|
|
|
did not specify
|
|
|
|
.B MPOL_F_ADDR
|
|
|
|
and
|
|
|
|
.I addr
|
|
|
|
is not NULL.
|
|
|
|
Or,
|
|
|
|
.I flags
|
|
|
|
specified
|
|
|
|
.B MPOL_F_NODE
|
|
|
|
but not
|
|
|
|
.B MPOL_F_ADDR
|
|
|
|
and the current process policy is not
|
|
|
|
.BR MPOL_INTERLEAVE .
|
2008-08-08 20:02:56 +00:00
|
|
|
Or,
|
|
|
|
.I flags
|
|
|
|
specified
|
|
|
|
.B MPOL_F_MEMS_ALLOWED
|
|
|
|
with either
|
|
|
|
.B MPOL_F_ADDR
|
|
|
|
or
|
|
|
|
.BR MPOL_F_NODE .
|
2007-12-20 11:25:58 +00:00
|
|
|
(And there are other
|
|
|
|
.B EINVAL
|
|
|
|
cases.)
|
2008-08-13 08:19:47 +00:00
|
|
|
.SH VERSIONS
|
|
|
|
The
|
2009-09-27 07:26:27 +00:00
|
|
|
.BR get_mempolicy ()
|
2008-08-13 08:19:47 +00:00
|
|
|
system call was added to the Linux kernel in version 2.6.7.
|
2007-11-24 10:15:53 +00:00
|
|
|
.SH CONFORMING TO
|
2007-12-25 21:28:09 +00:00
|
|
|
This system call is Linux-specific.
|
2006-02-08 03:20:44 +00:00
|
|
|
.SH NOTES
|
2008-08-13 08:19:47 +00:00
|
|
|
For information on library support, see
|
|
|
|
.BR numa (7).
|
2006-02-08 03:20:44 +00:00
|
|
|
.SH SEE ALSO
|
2008-07-03 12:20:42 +00:00
|
|
|
.BR getcpu (2),
|
2006-02-08 03:20:44 +00:00
|
|
|
.BR mbind (2),
|
2007-08-27 11:09:06 +00:00
|
|
|
.BR mmap (2),
|
2006-02-08 03:20:44 +00:00
|
|
|
.BR set_mempolicy (2),
|
2008-07-14 15:52:21 +00:00
|
|
|
.BR numa (3),
|
2008-08-13 08:19:47 +00:00
|
|
|
.BR numa (7),
|
2008-07-14 15:52:21 +00:00
|
|
|
.BR numactl (8)
|