Linux Blog

GET_MEMPOLICY

Section: Linux Programmer's Manual (2)
Updated: 2006-02-07
Index Return to Main Contents
 

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)


 

Index

NAME
SYNOPSIS
DESCRIPTION
RETURN VALUE
CONFORMING TO
NOTES
Versions and Library Support
SEE ALSO




Random Man Pages:
host
Class::Struct
wtf
gpm-types