Re: /proc/kcore size incorrect ?

From: Brian Waite
Date: Tue Oct 25 2005 - 08:44:22 EST


On Tuesday 25 October 2005 8:04 am, Matan Peled wrote:
> J.A. Magallon wrote:
> > I expected /proc/kcore to give the size of your installed memory, with
> > the reserved BIOS areas just not accesible, but it looks like it already
> > has them discounted, so gives 1022 Mb.
> >
> > It looks really silly to have a motd say "wellcome to this box, it has
> > 2 xeons and 1022 Mb of RAM".
>
> I don't know why, but 'du' seems to be doing a better job.
>
> chaosite@kaitou ~ $ du /proc/kcore --block-size=1M
> 1024 /proc/kcore
> chaosite@kaitou ~ $ echo $(($(stat -c %s /proc/kcore) / 1024 / 1024))
> 1023
To show just how fragile your tests are, here is what my laptop reports with 1
GB memory:

bwaite@ronzoni:~> uname -a
Linux ronzoni 2.6.11.4-21.9-default #1 Fri Aug 19 11:58:59 UTC 2005 i686 i686
i386 GNU/Linux
bwaite@ronzoni:~> du /proc/kcore --block-size=1M
897 /proc/kcore

bwaite@ronzoni:~> echo $(($(stat -c %s /proc/kcore) / 1024 / 1024))
896

bwaite@ronzoni:~> dmesg | grep MEM
127MB HIGHMEM available.
896MB LOWMEM available.

bwaite@ronzoni:~> dmesg | grep Memory:
Memory: 1033684k/1048248k available (1866k kernel code, 13796k reserved, 658k
data, 204k init, 130744k highmem)

In short why not use free and show what your users can use. Otherwise, just
make a static motd and change it whenever you change memory configurations. I
can't believe you are changing that often. If you are going to go overboard
and write a script just start doing the round up on your own.

Thanks
Brian

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/