10

Correct me if I'm wrong but the top command only monitors the memory usage of applications, not the memory usage dedicated to the kernel.

How would you go about monitoring usage of memory dedicated to the kernel?

2 Answers 2

7

The kernel exports this information via /proc/slabinfo. It's not very easy to read, so there's also a slabtop tool (from procps, which you probably have installed already).

This invocation is what I usually use, but check the man page to see what else it can do:

slabtop -s c
1

AFAIK, SLAB is one of several memory allocators of kernel

kernel use much more memory

see "smem -twk"

for example, ubuntu desktop

# smem -twk
Area                           Used      Cache   Noncache
firmware/hardware                 0          0          0
kernel image                      0          0          0
kernel dynamic memory          1.1G     802.0M     299.7M
userspace memory               2.2G     218.1M       2.0G
free memory                  440.1M     440.1M          0
----------------------------------------------------------
                               3.7G       1.4G       2.3G

# slabtop -s c

 Active / Total Objects (% used)    : 486431 / 618408 (78,7%)
 Active / Total Slabs (% used)      : 17621 / 17621 (100,0%)
 Active / Total Caches (% used)     : 77 / 108 (71,3%)
 Active / Total Size (% used)       : 157060,61K / 182206,62K (86,2%)
 Minimum / Average / Maximum Object : 0,01K / 0,29K / 8,00K
1
  • Can you explain the difference between Total Size of ~180MB in slabtop and kernel dynamic memory-noncache ~ 300mb in smem?
    – mitsos1os
    Dec 2, 2020 at 19:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .