Name

get_mempolicy — Retrieve NUMA memory policy for a process

Synopsis

#include <numaif.h>
int get_mempolicy( int *  policy,
  unsigned long *  nodemask,
  unsigned long   maxnode,
  unsigned long   addr,
  unsigned long   flags);

DESCRIPTION

get_mempolicy() retrieves the NUMA policy of the calling process or of a memory address, depending on the setting of flags.

A NUMA machine has different memory controllers with different distances to specific CPUs. The memory policy defines in which node memory is allocated for the process.

If flags is specified as 0, then information about the calling process's default policy (as set by set_mempolicy(2)) is returned.

If flags specifies MPOL_F_ADDR, then information is returned about the policy governing the memory address given in addr. This policy may be different from the process's default policy if set_mempolicy(2) has been used to establish a policy for the page containing addr.

If policy is not NULL, then it is used to return the policy. If nodemask is not NULL, then it is used to return the nodemask associated with the policy. maxnode is the maximum bit number plus one that can be stored into nodemask. The bit number is always rounded to a multiple of unsigned long.

For an overview of the possible policies see set_mempolicy(2).

RETURN VALUE

On success, get_mempolicy() returns 0; on error, −1 is returned and errno is set to indicate the error.

CONFORMING TO

This system call is Linux specific.

NOTES

This manual page is incomplete: it does not document the details the MPOL_F_NODE flag, which modifies the operation of get_mempolicy(). This is deliberate: this flag is not intended for application use, and its operation may change or it may be removed altogether in future kernel versions. Do not use it.

Versions and Library Support

See mbind(2).

SEE ALSO

mbind(2), set_mempolicy(2), numactl(8), numa(3)


  Copyright 2003,2004 Andi Kleen, SuSE Labs.

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.

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
the use of the information contained herein.

Formatted or processed versions of this manual, if unaccompanied by
the source, must acknowledge the copyright and authors of this work.

2006-02-03, mtk, substantial wording changes and other improvements