I need to find the RAM usage of kernel space and user space memory used. On seeing
cat /proc/meminfo
I couldn't able to find the exact details. Is there any command line to find the RAM usage of kernel space and user space memory used.
I need to find the RAM usage of kernel space and user space memory used. On seeing
cat /proc/meminfo
I couldn't able to find the exact details. Is there any command line to find the RAM usage of kernel space and user space memory used.
Could you elaborate a bit what do you mean by "kernel" in this context and why would you want to separate that from the rest of the system?
You can use
cat /proc/meminfo
or
free -m
to get some idea about memory usage in general. In general "available memory" will be the maximum amount of RAM that can be acquired in near future by processes and if more is requested, the system will slow down. Also note that using all "available memory" also requires sacrifying all of the disk cache which will make future disk access slower.
The memory used for buffers/cache (nowadays a same thing but historically Linux had separate memory areas for those needs) can be examined with sudo slabtop -sc
– that displays buffer/cache ("slab cache") usage and active use percentage (you can think this as cache hit rate). If the items that take most RAM have high "USE" percentage, your kernel is working fine.
If you really want to speak about "kernel memory usage" you have to decide if kernel modules, page tables, TCP/IP receive buffers, disk cache, etc. are part of the memory you're interested in. Personally, I really don't care if some piece is technically kernel process or user mode process - if it's required for the working system, it needs to stay anyway.
One interpretation for kernel usage:
grep Memory: /var/log/dmesg | \
grep -E -o '[0-9]+K (kernel code|data|rwdata|rodata|init)' &&
awk '{print $2/1024 "K " $1 }' /proc/modules | sort -hr
Example output:
8198K kernel code
1290K rwdata
3940K rodata
1428K init
1764K i915
1192K xfs
1068K btrfs
572K kvm
...
See also: