Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 680
user3743384 Avatar asked Feb 01 '26 17:02

user3743384


1 Answers

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.

like image 125
Alexandre de Champeaux Avatar answered Feb 03 '26 07:02

Alexandre de Champeaux