user3743384
user3743384

Reputation: 101

numactl --hardware showing incorrect information

I am working on a NUMA computer. It has two nodes with 16GB ram on each node. When I am running a large program, I used both htop and numactl --hardware to observe the memory consumption. However I got two different result.

htop showed that my program consumed around 20GB of memory in total. However, numactl --hardware showed that almost 32GB is used. So, which one is correct? Or is numactl --hardware not showing the actual resident memory but other kinds of memory?

Results

Upvotes: 1

Views: 1811

Answers (2)

user3743384
user3743384

Reputation: 101

It turns out that numactl --hardware regards cache memory as "used memory" but not "free memory". That's why it shows much more memory consumption that htop shows.

A good read: http://www.linuxatemyram.com/

Upvotes: 1

Chris
Chris

Reputation: 4231

numactl --hardware memory output comes from the numa_node_size64() function in libnuma, which in turn gets the info from the MemTotal and MemFree values in /sys/devices/system/node/node%d/meminfo.

Assuming you are on Linux, you might try cat /sys/devices/system/node/node0/meminfo (same for node1) to see much more detailed memory info. You should be able to correlate some of those values with your htop output. If that does not help, one would have to look at the kernel source how the MemFree value is derived.

Here's sample output from my single-node system. You see there's a lot of information:

Node 0 MemTotal:        7069704 kB
Node 0 MemFree:         4099480 kB
Node 0 MemUsed:         2970224 kB
Node 0 Active:          1677108 kB
Node 0 Inactive:         934216 kB
Node 0 Active(anon):    1056284 kB
Node 0 Inactive(anon):    46232 kB
Node 0 Active(file):     620824 kB
Node 0 Inactive(file):   887984 kB
Node 0 Unevictable:          16 kB
Node 0 Mlocked:              16 kB
Node 0 Dirty:               220 kB
Node 0 Writeback:             0 kB
Node 0 FilePages:       1556076 kB
Node 0 Mapped:           249100 kB
Node 0 AnonPages:       1055236 kB
Node 0 Shmem:             47276 kB
Node 0 KernelStack:        3712 kB
Node 0 PageTables:        33648 kB
Node 0 NFS_Unstable:          0 kB
Node 0 Bounce:                0 kB
Node 0 WritebackTmp:          0 kB
Node 0 Slab:             218156 kB
Node 0 SReclaimable:     168548 kB
Node 0 SUnreclaim:        49608 kB
Node 0 AnonHugePages:         0 kB
Node 0 HugePages_Total:     0
Node 0 HugePages_Free:      0
Node 0 HugePages_Surp:      0

Upvotes: 3

Related Questions