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.)
You may want to check the NUMA API: http://linux.die.net/man/3/numa. From a cursory look,
numa_alloc_onnode()
andnuma_get_run_node_mask()
stand out as useful.May be some combination of functions in the API can help you address the reason why you want to know the node number.