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.
source
share