How is NUMA represented in virtual memory?

北战南征 提交于 2019-12-06 09:43:07

A quick answer is to have the program look at /proc/self/numa_maps. An example output looks like:

$ cat /proc/self/numa_maps    # dumps current zsh numa_maps
55a4d27ff000 default file=/usr/bin/zsh mapped=177 N0=177 kernelpagesize_kB=4
55a4d2ab9000 default file=/usr/bin/zsh anon=2 dirty=2 N0=2 kernelpagesize_kB=4
55a4d2abb000 default file=/usr/bin/zsh anon=6 dirty=6 N0=4 N1=2 kernelpagesize_kB=4
55a4d2ac1000 default anon=9 dirty=9 N0=4 N1=5 kernelpagesize_kB=4

The first field shown on each line is the starting address that allows a correlation with output from /proc/pid/maps. Then N<node>=<pages> tells you how many pages are allocated on each node.

So if you need to know the NUMA node number of a memory area, do a bisect search on the output of this file.

Some more information here:

https://www.kernel.org/doc/Documentation/vm/numa_memory_policy.txt https://lwn.net/Articles/486858/ Toward better NUMA scheduling

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!