I am currently working on a NUMA system with 2 nodes. I got a pointer pointing to some memory, but I do not know which node it is in. Is there any way I can get the node number of the memory?
(The reason that getting the node mask of the current thread does not work is that, the memory of the node is full, so even the thread is affined to the current node, it may still allocate the memory on the adjacent node. Therefore, I am seeking a direct way to get the memory location.)
This is doable on Linux using numa_move_pages. This is simply a sugar for move pages. If you don't pass any nodes to it, it returns the id of the NUMA node of the pointer in status.
Be well aware that your pointer needs to point to a page that resides in physical memory (ie has page-faulted already), otherwise you will get an ENOENT.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With