memory usage on Scyld slave nodes (fwd)

Daniel Ridge newt at scyld.com
Fri Feb 16 21:00:48 PST 2001


One observation -- though -- is that the kernel always _knows_ the amount
of actually free memory (nr_free_pages) and buffered (buffermem)  and has
to expensively compute the other statistics by iterating in the snippet
(from arch/i386/mm/init.c) whenever you look at /proc/meminfo.

        i = max_mapnr;
        val->totalram = 0;
        val->sharedram = 0;
        val->freeram = nr_free_pages << PAGE_SHIFT;
        val->bufferram = buffermem;
        while (i-- > 0)  {
                if (PageReserved(mem_map+i))
                        continue;
                val->totalram++;
                if (!atomic_read(&mem_map[i].count))
                        continue;
                val->sharedram += atomic_read(&mem_map[i].count) - 1;
        }
        val->totalram <<= PAGE_SHIFT;
        val->sharedram <<= PAGE_SHIFT;
        return;

(I suppose this post is now GPLed)

This can be a hugely expensive function to drive at even a couple of
hertz.

On Fri, 16 Feb 2001, Jag wrote:

> > > I'm adding up all the memory that's in use on the entire machine, include
> > > buffer cache for the filesystem.  Linux tries to use any spare memory up
> > > to about 90% of available as a cache of the filesystem.
> > > 
> > > I realize that this make that value in beostatus pretty much
> > > worthless.  It's also been pointed out that it's also the more
> > > expensive for the kernel to compute.  I believe "top" actually walks
> > > though the proc table and adds up all the memory to get it's value,
> > > but that also seems a bit expensive to me.





More information about the Beowulf mailing list