user3743384
user3743384

Reputation: 101

Get the location of a memory in NUMA

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.)

Upvotes: 3

Views: 1280

Answers (2)

Alexandre de Champeaux
Alexandre de Champeaux

Reputation: 1892

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.

Upvotes: 1

bytefire
bytefire

Reputation: 4422

You may want to check the NUMA API: http://linux.die.net/man/3/numa. From a cursory look, numa_alloc_onnode() and numa_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.

Upvotes: 0

Related Questions