move_pages(2) System Calls Manual move_pages(2) move_pages - LIBRARY NUMA (Non-Uniform Memory Access) policy library (libnuma, -lnuma) #include long move_pages(int pid, unsigned long count, void *pages[.count], const int nodes[.count], int status[.count], int flags); move_pages() pages pid , nodes. status. flags . pid , . pid 0, move_pages() . : o Up to and including Linux 4.12: the caller must be privileged (CAP_SYS_NICE) or the real or effective user ID of the calling process must match the real or saved-set user ID of the target process. o , , , UID ; Linux 4.13. Linux 4.13, ptrace PTRACE_MODE_READ_REALCREDS ; ptrace(2). count . : pages, nodes status. pages , . . , pid. nodes , . . , nodes NULL; move_pages() , status , . , . status is an array of integers that return the status of each page. The array contains valid values only if move_pages() did not return an error. Preinitialization of the array to a value which cannot represent a real numa node or valid error of status array could help to identify pages that have been migrated. flags . MPOL_MF_MOVE , , . MPOL_MF_MOVE_ALL , , . MPOL_MF_MOVE_ALL (CAP_SYS_NICE). status : 0..MAX_NUMNODES , . -EACCES , MPOL_MF_MOVE_ALL. -EBUSY . . , - . -EFAULT . -EIO . , (dirty), (migration), . -EINVAL . (migration), . -ENOENT . -ENOMEM . On success move_pages() returns zero. On error, it returns -1, and sets errno to indicate the error. If positive value is returned, it is the number of nonmigrated pages. Positive value The number of nonmigrated pages if they were the result of nonfatal reasons (since Linux 4.17). E2BIG . Linux 2.6.29, . EACCES . EFAULT . EINVAL , MPOL_MF_MOVE MPOL_MF_MOVE_ALL, (migrate) . ENODEV (not online). EPERM MPOL_MF_MOVE_ALL, (CAP_SYS_NICE). , , (CAP_SYS_NICE). ESRCH . Linux. Linux 2.6.18. numa(7). get_mempolicy(2) MPOL_F_MEMS_ALLOWED , . , . , ( ) , (. mbind(2)) / (. set_mempolicy(2)). , move_pages(). glibc, libnuma-devel . . get_mempolicy(2), mbind(2), set_mempolicy(2), numa(3), numa_maps(5), cpuset(7), numa(7), migratepages(8), numastat(8) aereiae , Alexey , Azamat Hackimov , Dmitriy S. Seregin , Dmitry Bolkhovskikh , ITriskTI , Max Is , Yuri Kozlov , ; GNU 3 , . . , , . Linux man-pages 6.06 31 2023 . move_pages(2)