Re: Memory Measurements and Lots of Files and Inodes

From: Andrew Morton (
Date: Wed Dec 11 2002 - 19:09:34 EST

"Patrick R. McManus" wrote:
> ...
> Just sitting back and watching vmstat while this runs my 'free' memory
> drops from ~600MB to about ~16MB.. the buffers and cache remain roughly
> constant.. at 16MB some sort of garbage collection kicks in - there is
> a notable system pause and ~70MB moves from the used to the 'free'
> column... this process repeats more or less in a steady state.

Probably `negative dentries' - cached directory entries which say
"this file isn't there" so we don't need to go into the fs to
find that out.

If you could share your test apps that would help a lot.
> If, while this is going on, I run another little app that does
> {x= malloc(300MB), memset (x,0,300MB), free (x)}.. suddenly I can move
> 300MB from the used to the 'free' state...

The slab cache (general kernel memory allocator+cache) has mechanisms
for freeing cached objects when memory gets tight. That will recycle
all those negative dentries. If that's what you're seeing.
> ...
> Can anybody provide a better metric for "ram free for userspace
> allocations"?

On your machine it'll be "all of swap plus all of physical memory
minus whatever malloc'ed memory you're using now minus 8-12 megabytes".
There isn't much memory which cannot be reclaimed unless you have a
huge machine or you're doing odd things.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

This archive was generated by hypermail 2b29 : Sun Dec 15 2002 - 22:00:23 EST