2004-01-12 09:04:13

by J.A. Magallon

[permalink] [raw]
Subject: /proc/kcore size

Hi all...

To the request of one of my users, I installed the 'hinv' program (1.4pre1) by
Larry McVoy.

Problem: it detects the memory amount in the box by stat'ing /proc/kcore.
Thats not the problem, but that the box has 1Gb of memory, and kcore is just
896Mb big.

Kernel is built with 4Gb support:

annwn:/proc# free
total used free shared buffers cached
Mem: 1033172 1017772 15400 0 164792 556416
-/+ buffers/cache: 296564 736608
Swap: 1951856 8 1951848

annwn:/proc# hinv
Main memory size: 896 Mbytes
...

annwn:/proc# ll /proc/kcore
-r-------- 1 root root 939528192 Jan 12 10:02 /proc/kcore

Exactly the same as a box that has _really_ 896 Mb:

werewolf:/proc# ll kcore
-r-------- 1 root root 939528192 Jan 12 10:02 kcore

werewolf:/proc# free
total used free shared buffers cached
Mem: 905012 276008 629004 0 27268 109344
-/+ buffers/cache: 139396 765616
Swap: 345356 0 345356

BUG ?

TIA

--
J.A. Magallon <jamagallon()able!es> \ Software is like sex:
werewolf!able!es \ It's better when it's free
Mandrake Linux release 10.0 (Cooker) for i586
Linux 2.6.1-jam2 (gcc 3.3.2 (Mandrake Linux 10.0 3.3.2-4mdk))


2004-01-12 09:08:39

by J.A. Magallon

[permalink] [raw]
Subject: Re: /proc/kcore size


On 01.12, J.A. Magallon wrote:
> Hi all...
>
> To the request of one of my users, I installed the 'hinv' program (1.4pre1) by
> Larry McVoy.
>
> Problem: it detects the memory amount in the box by stat'ing /proc/kcore.
> Thats not the problem, but that the box has 1Gb of memory, and kcore is just
> 896Mb big.
>
> Kernel is built with 4Gb support:
>
> annwn:/proc# free
> total used free shared buffers cached
> Mem: 1033172 1017772 15400 0 164792 556416
> -/+ buffers/cache: 296564 736608
> Swap: 1951856 8 1951848
>
> annwn:/proc# hinv
> Main memory size: 896 Mbytes
> ...
>
> annwn:/proc# ll /proc/kcore
> -r-------- 1 root root 939528192 Jan 12 10:02 /proc/kcore
>
> Exactly the same as a box that has _really_ 896 Mb:
>
> werewolf:/proc# ll kcore
> -r-------- 1 root root 939528192 Jan 12 10:02 kcore
>
> werewolf:/proc# free
> total used free shared buffers cached
> Mem: 905012 276008 629004 0 27268 109344
> -/+ buffers/cache: 139396 765616
> Swap: 345356 0 345356
>
> BUG ?
>

Ooops, sorry. annwn is a (patched)2.4.24 and werewolf is 2.6.1-mm2(+hfsplusfs).

--
J.A. Magallon <jamagallon()able!es> \ Software is like sex:
werewolf!able!es \ It's better when it's free
Mandrake Linux release 10.0 (Cooker) for i586
Linux 2.6.1-jam2 (gcc 3.3.2 (Mandrake Linux 10.0 3.3.2-4mdk))

2004-01-12 18:00:41

by Tony Luck

[permalink] [raw]
Subject: Re: /proc/kcore size

> Problem: it detects the memory amount in the box by stat'ing /proc/kcore.
> Thats not the problem, but that the box has 1Gb of memory, and kcore is just
> 896Mb big.

It may not be the specific problem that you have now, but it is a
problem in general. The size of /proc/kcore may be a good
approximation for the amount of memory on machines that have
contiguous physical memory starting at a base physical address
of 0x0, but on an increasing number of machines it may give
a grossly inflated value (perhaps an SGI Altix user will post
the output from "ls -l /proc/kcore").

-Tony Luck

2004-01-12 18:52:16

by Jesse Barnes

[permalink] [raw]
Subject: Re: /proc/kcore size

>From 2.4:
[jbarnes@tomahawk 999-jb.patch]$ cat /proc/meminfo
total: used: free: shared: buffers: cached:
Mem: 32657883136 31249809408 1408073728 0 0 10380558336
Swap: 10485727232 67059712 10418667520
MemTotal: 31892464 kB
MemFree: 1375072 kB
MemShared: 0 kB
Buffers: 0 kB
Cached: 10112928 kB
SwapCached: 24336 kB
Active: 7169808 kB
Inactive: 3035504 kB
HighTotal: 0 kB
HighFree: 0 kB
LowTotal: 31892464 kB
LowFree: 1375072 kB
SwapTotal: 10239968 kB
SwapFree: 10174480 kB
HugePages_Total: 0
HugePages_Free: 0
Hugepagesize: 262144 kB
[jbarnes@tomahawk 999-jb.patch]$ ls -l /proc/kcore
-r-------- 1 root root 1909045870592 Jan 12 10:39 /proc/kcore

and from 2.6:
[root@morale root]# cat /proc/meminfo
MemTotal: 7583600 kB
MemFree: 7432864 kB
Buffers: 7952 kB
Cached: 41248 kB
SwapCached: 0 kB
Active: 52592 kB
Inactive: 34736 kB
HighTotal: 0 kB
HighFree: 0 kB
LowTotal: 7583600 kB
LowFree: 7432864 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Dirty: 256 kB
Writeback: 0 kB
Mapped: 33392 kB
Slab: 17376 kB
Committed_AS: 27312 kB
PageTables: 2112 kB
VmallocTotal: 137426709824 kB
VmallocUsed: 128 kB
VmallocChunk: 137426709696 kB
[root@morale root]# ls -l /proc/kcore
-r-------- 1 root root 808460500992 Jan 12 10:51 /proc/kcore



On Mon, Jan 12, 2004 at 10:00:19AM -0800, Luck, Tony wrote:
> > Problem: it detects the memory amount in the box by stat'ing /proc/kcore.
> > Thats not the problem, but that the box has 1Gb of memory, and kcore is just
> > 896Mb big.
>
> It may not be the specific problem that you have now, but it is a
> problem in general. The size of /proc/kcore may be a good
> approximation for the amount of memory on machines that have
> contiguous physical memory starting at a base physical address
> of 0x0, but on an increasing number of machines it may give
> a grossly inflated value (perhaps an SGI Altix user will post
> the output from "ls -l /proc/kcore").
>
> -Tony Luck
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/