Issue
I have the following config in linux :
cat /proc/sys/vm/nr_hugepages
100
cat /proc/meminfo | grep "Page"
AnonPages: 149012 kB
PageTables: 13800 kB
AnonHugePages: 4096 kB
HugePages_Total: 100
HugePages_Free: 100
HugePages_Rsvd: 0
HugePages_Surp: 0
numastat -m
Per-node system memory usage (in MBs):
Node 0 Node 1 Total
--------------- --------------- ---------------
HugePages_Total 100.00 100.00 200.00
HugePages_Free 100.00 100.00 200.00
then I run my test application which consume hugepage , then watch again :
AnonPages: 146592 kB
PageTables: 13316 kB
AnonHugePages: 4096 kB
HugePages_Total: 100
HugePages_Free: 82
HugePages_Rsvd: 0
HugePages_Surp: 0
Per-node system memory usage (in MBs):
Node 0 Node 1 Total
--------------- --------------- ---------------
HugePages_Total 100.00 100.00 200.00
HugePages_Free 100.00 64.00 164.00
Why does numastat -m
show node1 has 64MB free but meminfo
shows 82 pages free?
Which number is wrong?! Or are both wrong?!
Solution
I would say that the figures are consistent. None is wrong.
You have 100 huge pages in the system. Each page represents 2 MB of data. So we are talking about 200 MB of memory.
Note that the numastat -m commands displays memory in MB (not expressed in pages). On this NUMA machine, the system distributes this memory evenly between NUMA nodes (100 MB and 100 MB). The HugePages statistics in /proc/meminfo are expressed in number of pages.
Once the application runs, you get 82 pages free, so 18 pages in use, which results in 18*2 MB in use = 36 MB. numastat -m displays 64 MB free on node 1, which effectively corresponds to 100 MB - 36 MB.
Provided my arithmetic is correct, there is nothing wrong here.
Answered By - Didier Spezia Answer Checked By - Willingham (WPSolving Volunteer)