/proc/kcore size incorrect ?

From: J.A. Magallon (jamagallon_at_able.es)
Date: 10/23/05

  • Next message: Helge Hafting: "Re: BUG in the block layer (partial reads not reported)"
    Date:	Sun, 23 Oct 2005 23:58:06 +0200
    To: "Linux-Kernel, " <linux-kernel@vger.kernel.org>
    
    
    

    Hi all...

    Probably this is a stupid question, but anyways...

    I'm trying to make a script to generate an /etc/motd, and I wanted to
    include memory size of the box.

    I tried:

            echo $(($(stat -c %s /proc/kcore) / 1024 / 1024)) "Mb"

    but it gives 1022 for a 1Gb box.

    In fact:

            werewolf:~# ll /proc/kcore
            -r-------- 1 root root 1072566272 2005.10.23 23:53 /proc/kcore
            werewolf:~# stat -c %s /proc/kcore
            1072566272

            werewolf:~# echo $((1024*1024*1024))
            1073741824

    Why that difference ?

    TIA

    BTW, any simple method to get the real mem of the box ?

    --
    J.A. Magallon <jamagallon()able!es>     \               Software is like sex:
    werewolf!able!es                         \         It's better when it's free
    Mandriva Linux release 2006.1 (Cooker) for i586
    Linux 2.6.13-jam9 (gcc 4.0.1 (4.0.1-5mdk for Mandriva Linux release 2006.0))
    
    

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



  • Next message: Helge Hafting: "Re: BUG in the block layer (partial reads not reported)"

    Relevant Pages

    • strange behavior creating and deleting files
      ... as long as memory allocation is concerned. ... running a simple script that continuously creates and deletes files on ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: 2.4.23aa2 (bugfixes and important VM improvements for the high end)
      ... > triggering the zone-normal shortage in 32G, ... Also bear in mind that as memory gets tight, ... Without shared pagetables, ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: log-buf-len dynamic
      ... Wake up, dude. ... disk and memory. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: swsusp update: supports discontingmem/highmem
      ... driver is responsible for the memory should handle any required state ... Can't you back out nicely if you don't have enough memory for the image? ... Nigel Cunningham ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: Request: I/O request recording
      ... > next reboot. ... > that everything which you will need in the subsequent boot is already in ... > pretty much a waste of time, gaining only 10% or so, from memory. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)