开发者

Relation between Linux /proc/meminfo and /sys/devices/system/node/nodex/meminfo

开发者 https://www.devze.com 2023-02-05 02:31 出处:网络
I\'d like to get the amount of \"free memory\" per NUMA node. When dealing with a whole machine, one usually parses /proc/meminfo like free does (the number wanted is MemFree + Buffers + Cached).

I'd like to get the amount of "free memory" per NUMA node. When dealing with a whole machine, one usually parses /proc/meminfo like free does (the number wanted is MemFree + Buffers + Cached). There also exist /sys/devices/system/node/nodex/meminfo, which seem to display number开发者_开发百科s per NUMA node. Does anybody know how these numbers can be correlated to the content of /proc/meminfo? My trivial assumption would be to sum up some numbers for all NUMA nodes in the system, and the result is equal to some number in /proc/meminfo. But so far I failed to figure out the relationships, especially for page caches.


The code for proc is in fs/proc/meminfo.c, for the sysfs files it's in drivers/base/node.c. Comparing them might give you some hints.

Note that you'll probably never get the numbers to add up 100%, because you can't atomically read the content of all the files, so the values will change while you're reading them.

There also seems to be an inconsistency in the total RAM reported via both methods. One explanation for that is that free_init_mem doesn't appear to be NUMA aware, and increments total_ram_pages but does not do any NUMA accounting.

0

精彩评论

暂无评论...
验证码 换一张
取 消