Section: Linux Programmer's Manual (2)
Return to Main Contents
get_mempolicy - Retrieve NUMA memory policy for a process
int get_mempolicy(int *mode, unsigned long *nodemask,
unsigned long maxnode, unsigned long addr,
unsigned long flags);
Link with -lnuma.
retrieves the NUMA policy of the calling process or of a memory address,
depending on the setting of
A NUMA machine has different
memory controllers with different distances to specific CPUs.
The memory policy defines from which node memory is allocated for
is specified as 0,
then information about the calling process's default policy
(as set by
The policy returned
may be used to restore the process's policy to its state at
the time of the call to
(available since Linux 2.6.24), the
argument is ignored and the set of nodes [memories] that the
process is allowed to specify in subsequent calls to
[in the absense of any
is returned in
It is not permitted to combine
then information is returned about the policy governing the memory
address given in
This policy may be different from the process's default policy if
or one of the helper functions described in
has been used to establish a policy for the memory range containing
argument is not NULL, then
will store the policy mode and any optional
of the requested NUMA policy in the location pointed to by this argument.
is not NULL, then the nodemask associated with the policy will be stored
in the location pointed to by this argument.
specifies the number of node IDs
that can be stored into
is, the maximum node ID plus one.
The value specified by
is always rounded to a multiple of
will return the node ID of the node on which the address
is allocated into the location pointed to by
If no page has yet been allocated for the specified address,
will allocate a page as if the process had performed a read
[load] access to that address, and return the ID of the node
where that page was allocated.
and the process's current policy is
will return in the location pointed to by a non-NULL
the node ID of the next node that will be used for
interleaving of internal kernel pages allocated on behalf of the process.
These allocations include pages for memory mapped files in
process memory ranges mapped using the
call with the
flag for read accesses, and in memory ranges mapped with the
flag for all accesses.
Other flag values are reserved.
For an overview of the possible policies see
on error, -1 is returned and
is set to indicate the error.
Part of all of the memory range specified by
points outside your accessible address space.
The value specified by
is less than the number of node IDs supported by the system.
specified values other than
did not specify
is not NULL.
and the current process policy is not
(And there are other
system call was added to the Linux kernel in version 2.6.7.
This system call is Linux-specific.
For information on library support, see
This page is part of release 3.27 of the Linux
A description of the project,
and information about reporting bugs,
can be found at
- RETURN VALUE
- CONFORMING TO
- SEE ALSO
This document was created by
using the manual pages.