Re: 2.0.1: /proc/meminfo wrong

Carsten Paeth (calle@calle.in-berlin.de)
Thu, 4 Jul 1996 15:10:49 +0200 (MET DST)


>
> I just noticed this same thing at work, I have 16Meg Ram, and it only
> says I have 14Meg. What's up???
>

The kernel is using 2Meg :-)

>
> ---russ
>

>
> On Wed, 3 Jul 1996, Ronald Wahl wrote:
>
> >
> > Hi,
> >
> > Look at the shared field of the following output. How can it be creater
> > than my total memory?
> >
> > rwa@goliath:~$ cat /proc/meminfo
> > total: used: free: shared: buffers: cached:
> > Mem: 23670784 19726336 3944448 29261824 1191936 6049792
> > Swap: 100843520 53248 100790272
> > MemTotal: 23116 kB
> > MemFree: 3852 kB
> > MemShared: 28576 kB
> > Buffers: 1164 kB
> > Cached: 5908 kB
> > SwapTotal: 98480 kB
> > SwapFree: 98428 kB
> >

The output is a little bit confusing,
because most people think the meaning of 'shared' is

"how many ram is shared".

but the meaning of 'shared' is:

"how many ram won because of sharing".

The relevant part in the kernel is:

void si_meminfo(struct sysinfo *val)
{
int i;

i = high_memory >> PAGE_SHIFT;
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 (!mem_map[i].count)
continue;
val->sharedram += mem_map[i].count-1;
^^^^^^^^^^^^^^^^^^^
}
val->totalram <<= PAGE_SHIFT;
val->sharedram <<= PAGE_SHIFT;
return;
}

> >
> > ron
> >
[...]

calle

-- 
calle@calle.in-berlin.de