get_mempolicy¶
Intro¶
get_mempolicy - retrieve the current process memory placement policy
Description¶
The get_mempolicy system call retrieves the current process memory placement policy. It can be used to find out if the process is in a specific NUMA (non-uniform memory access) node and to retrieve the preferred node or list of allowed nodes to allocate memory. The function reads the effective process memory placement policy and not necessarily the configurable policy. It can be used to set up a process-wide policy via a call to mbind.
The mode
argument can be either MPOL_F_NODE (retrieve a list of nodes) or MPOL_F_ADDR (retrieve a single node). If mode
is set to MPOL_F_NODE and maxnode
is greater than zero, the first maxnode
numbers of the node set of nodemask
will be copied to the policy. Note that no optional MPOL_F_MEMS_ALLOWED flag is supported by this call.
The addr
argument can be used when mode
is set to MPOL_F_ADDR, which will report the local node on which the memory address resides.
Arguments¶
mode
:int*
[K] - set to MPOL_F_NODE to copy a set of nodes and MPOL_F_ADDR to get a specific node for the address.nodemask
:unsigned long*
[KU] - pointer to a node bitmask, from which a node set is returned.maxnode
:unsigned long
[K] - maximum number of nodes to return. Must be non-zero ifmode
is set to MPOL_F_NODE.addr
:void*
[KU] - pointer to an address in virtual memory. Must be set if and only ifmode
is set to MPOL_F_ADDR.flags
:unsigned long
[K] - flags to control the system call behavior.
Available Tags¶
- K - Originated from kernel-space.
- U - Originated from user space (for example, pointer to user space memory used to get it)
Hooks¶
sys_get_mempolicy¶
Type¶
Kprobes
Purpose¶
To collect information about changes in the current process memory placement policy.
Example Use Case¶
If a process is spawned from a parent process, it can be useful to check the memory placement policy of the given process. The get_mempolicy syscall can be used to check if a process is in a specific NUMA node, and to retrieve the preferred node or list of allowed nodes to allocate memory.
Issues¶
No MPOL_F_MEMS_ALLOWED flag is supported by this call.
Related Events¶
- mbind - set the memory policy for a region of memory
- set_mempolicy - change the current process memory placement policy
This document was automatically generated by OpenAI and needs review. It might not be accurate and might contain errors. The authors of Tracee recommend that the user reads the "events.go" source file to understand the events and their arguments better.