This question is motivated by my shock when I discovered that Mac OS X kernel uses 750MB of RAM.
I have been using Linux for 20 years, and I always "knew" that the kernel RAM usage is dwarfed by X (is it true? has it ever been true?).
So, after some googling, I tried slabtop
which told me:
Active / Total Size (% used) : 68112.73K / 72009.73K (94.6%)
Does this mean that my kernel is using ~72MB of RAM now?
(Given that top
reports Xorg
's RSS as 17M, the kernel now dwarfs X, not the other way around).
What is the "normal" kernel RAM usage (range) for a laptop?
Why does MacOS use an order of magnitude more RAM than Linux?
PS. No answer here addressed the last question, so please see related questions:
Best Answer
Kernel is a bit of a misnomer. The Linux kernel is comprised of several proceses/threads + the modules (
lsmod
) so to get a complete picture you'd need to look at the whole ball and not just a single component.Incidentally mine shows
slabtop
:The man page for
slabtop
also had this to say:Dropping caches
Dropping my caches as @derobert suggested in the comments under your question does the following for me:
Sending a 3 does the following: free pagecache, dentries and inodes. I discuss this more in this U&L Q&A titled: Are there any ways or tools to dump the memory cache and buffer?". So 110MB of my space was being used by just maintaining the info regarding pagecache, dentries and inodes.
Additional Information
slabtop
in a bit more details. It's titled: Linux command of the day: slabtop.So how much RAM is my Kernel using?
This picture is a bit foggier to me, but here are the things that I "think" we know.
Slab
We can get a snapshot of the Slab usage using this technique. Essentially we can pull this information out of
/proc/meminfo
.Modules
Also we can get a size value for Kernel modules (unclear whether it's their size from on disk or when in RAM) by pulling these values from
/proc/modules
:Slabinfo
Much of the details about the SLAB are accessible in this proc structure,
/proc/slabinfo
:Dmesg
When your system boots there is a line that reports memory usage of the Linux kernel just after it's loaded.
References