Saturday, February 16, 2013

[Linux] Linux上NUMA相关的命令

查看NUMA的memory设置等

$ cat /sys/devices/system/node/node*/meminfo 
Node 0 MemTotal:       16777216 kB
Node 0 MemFree:           14312 kB
Node 0 MemUsed:        16762904 kB
...
Node 0 HugePages_Total:  1000
Node 0 HugePages_Free:    744
Node 0 HugePages_Surp:      0
Node 1 MemTotal:       16763940 kB
Node 1 MemFree:         5289568 kB
Node 1 MemUsed:        11474372 kB
...
Node 1 HugePages_Total:  1000
Node 1 HugePages_Free:   1000
Node 1 HugePages_Surp:      0

查看NUMA统计数据

比如多少local node reference, 多少foreign node reference
$ cat /sys/devices/system/node/node*/numastat
numa_hit 759046092
numa_miss 333483705
numa_foreign 236930883
interleave_hit 12690
local_node 746065583
other_node 346464214
numa_hit 506048971
numa_miss 236930883
numa_foreign 333483705
interleave_hit 12713
local_node 507619074
other_node 235360780

使用numactl设置task的numa属性

prefer(并非强制)使用numa node0来执行my_app
$ numactl --preferred=0 ./my_app arg1 arg2
强制使用numa node0 的local cpu和local memory来执行my_app
$ numactl --cpubind=0 --membind=0 ./my_app arg1 arg2

No comments: