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

I would like to get the amount of "free memory" for the NUMA node. When you work with the whole machine, parse / proc / meminfo is usually used, for example, free (MemFree + Buffers + Cached number is required). There are also / sys / devices / system / node / nodex / meminfo which appear to map numbers to a NUMA node. Does anyone know how these numbers can be related to the contents of / proc / meminfo? My trivial assumption would be to sum some numbers for all NUMA nodes in the system, and the result is equal to some number in / proc / meminfo. But so far I have not been able to figure out the relationship, especially for page caches.

+3
source share
1 answer

The code for proc is in fs/proc/meminfo.c, for sysfs files it is in drivers/base/node.c. Comparing them can give you some tips.

Note that you will probably never get numbers to add 100%, because you cannot atomically read the contents of all files, so the values ​​will change while you read them.

There is also inconsistency in the total RAM reported by both methods. One explanation for this is that it free_init_memdoes not appear as NUMA, and increases total_ram_pages, but does not fulfill any NUMA requests.

+2
source

Source: https://habr.com/ru/post/1786134/


All Articles