Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check usage of different parts of memory?

I have computer with 2 Intel Xeon CPUs and 48 GB of RAM. RAM is divided between CPUs - two parts 24 GB + 24 GB. How can I check how much of each specific part is used?

So, I need something like htop, which shows how fully each core is used (see this example), but rather for memory than for cores. Or something that would specify which part (addresses) of memory are used and which are not.

like image 831
klm123 Avatar asked May 10 '11 14:05

klm123


2 Answers

The information is in /proc/zoneinfo, contains very similar information to /proc/vmstat except broken down by "Node" (Numa ID). I don't have a NUMA system here to test it for you and provide a sample output for a multi-node config; it looks like this on a one-node machine:

Node 0, zone      DMA
pages free     2122
      min      16
      low      20
      high     24
      scanned  0
      spanned  4096
      present  3963
[ ... followed by /proc/vmstat-like nr_* values ]
Node 0, zone   Normal
pages free     17899
      min      932
      low      1165
      high     1398
      scanned  0
      spanned  223230
      present  221486
nr_free_pages 17899
nr_inactive_anon 3028
nr_active_anon 0
nr_inactive_file 48744
nr_active_file 118142
nr_unevictable 0
nr_mlock     0
nr_anon_pages 2956
nr_mapped    96
nr_file_pages 166957
[ ... more of those ... ]
Node 0, zone  HighMem
pages free     5177
      min      128
      low      435
      high     743
      scanned  0
      spanned  294547
      present  292245
[ ... ]

I.e. a small statistic on the usage/availability total followed by the nr_* values also found on a system-global level in /proc/vmstat (which then allow a further breakdown as of what exactly the memory is used for).

If you have more than one memory node, aka NUMA, you'll see these zones for all nodes.

edit

I'm not aware of a frontend for this (i.e. a numa vmstat like htop is a numa-top), but please comment if anyone knows one !

like image 157
FrankH. Avatar answered Nov 02 '22 02:11

FrankH.


The numactl --hardware command will give you a short answer like this:

node 0 cpus: 0 1 2 3 4 5 node 0 size: 49140 MB node 0 free: 25293 MB node 1 cpus: 6 7 8 9 10 11 node 1 size: 49152 MB node 1 free: 20758 MB node distances: node 0 1 0: 10 21 1: 21 10

like image 42
VladimirS Avatar answered Nov 02 '22 02:11

VladimirS