So, past few weeks I’ve noticed a distinctly high RAM usage on my F19 desktop. It wasn’t showing up in top or htop as cache or buffer, so I figured that one of my applications was using all my memory up. My kernel starting swapping programs, which resulted in horribad performance.
At first I figured it was Chrome, so I tried using a hibernation plugin to hibernate my unused tabs. No worky. Tried shutting chrome and skype down to see if that would help and still no worky. Something was just desperately filling up all that memory.
So, downloaded a lovely little program that pie graphs your memory usage by process to see where it was all going.
And lo! For some reason, my userspace programs were taking up less than a fifth of my memory. WTF??
Time to investigate more. As I did some more research, I discovered a Linux tool called slabtop, which apparently displays the kernel’s cache memory usage. There, I found an entry called “dentry” that was taking up a full 5GB of my 10GB RAM. This is basically a directory entry cache for the filesystem, so that the kernel can reference previously accessed files more quickly. Queue another helpful article that describes how Linux uses memory!
http://linux-mm.org/Low_On_Memory
So, did some kernel tuning to make it more prone to reclaim dentry cache and make the kernel less swappy on my machine. And I found a way to flush out the dentry cache as well, which I’ll probably do periodically anyway. Final article!