numaif.h vs numa.h

1 minute read

  • numaif.h and numa.h are two header files provided by libnuma. In other words, you need to install libnuma to have these headers somewhere in your include path.

  • numaif.h is just a wrapper for Linux system calls related to NUMA management and not already wrapped in the libc. For these system calls, libnuma uses the Linux generic syscall function allowing to make a system call by providing its name and its parameters.

  • numa.h is the header exposing the high level functions provided by libnuma. The main goal for these functions is to abstract some details about using the Linux kernel NUMA management functions.

  • get_mempolicy is a Linux system call for NUMA management. As such, it’s also wrapped by libnuma and exposed by numaif.h. This function, among other things, can be used to get the NUMA node of a single page specified by a memory address.

  • numa_move_pages is function provided by libnuma and strangely exposed by numa.h. Indeed, all it does is calling the Linux kernel move_pages (man page : It simply uses the move_pages system call). As opposed to get_mempolicy it allows to get the NUMA node for several pages at once specified through a table.

Categories:

Updated: