简体   繁体   中英

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

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM