move_pages - Migrate process pages between node
The move_pages() system call moves pages from one NUMA node to another on behalf of the children of a process. It supports a subset of normal memory mappings, possibly shared between multiple processes - specifically just private anonymous mappings and shared mappings created with the mmap(2) MAP_SHARED and MAP_SHARED_VALIDATE flags.
Although the system call may be used on any process, the special semantics of the system call are only applicable to processes whose page tables are managed by a PowerPC hardware page table walker, such as POWER7 and later chips.
This system call allows processes and kernels to organize their working set into specific NUMA nodes, by placing pages and nodes. This can be used to speed up memory accesses and also to allow the user or administrator to move process pages into near-memory storage (such as the embedded DRAM available on some PowerPC machines) in order to save energy.
int[K] - The PID of the process whose pages should be moved.
unsigned long[U+K] - The number of pages to move.
const void**[U] - The addresses of the pages to be moved.
const int*[K] - The array of nodes to which the pages should be moved.
int*[U] - The array that will contain the result for each page (0 for success, -EFAULT for failure).
int[K] - Flags to specify behaviour (0 for regular mode, MPOL_MF_MOVE_ALL to exchange pages if the source or destination node is already full).
- K - Originated from kernel-space.
- U - Originated from user space (for example, pointer to user space memory used to get it)
- TOCTOU - Vulnerable to TOCTOU (time of check, time of use)
- OPT - Optional argument - might not always be available (passed with null value)
Kprobe + Kretprobes
To monitor the execution of the move_pages system call and its return value.
Example Use Case¶
If an application running on a multi-socketed system depends heavily on the transparency of the NUMA architecture in order to get good performance, then this system call can be used to move pages around in order to optimize its memory accesses.
This system call is limited to pages that are anonymous private mappings or shared mappings that were created with the mmap(2) MAP_SHARED and MAP_SHARED_VALIDATE flags, making it incompatible with many memory sharing strategies.
Also, it is not supported on Power7 and later chips, which could lead to unexpected results when running on such systems.
- munmap(2) - System call used to unmap pages from memory
- mmap(2) - System call used to map files or devices into memory.
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.