2003-08-10 20:09:49

by Remi Colinet

[permalink] [raw]
Subject: 2.6.0-test2 : size of /proc/kcore is different from RAM size.

Hi,

I have noticed that the /proc/kcore file has a different size (1Go)
compared with the available memory of my box (640Mo).

[root@tigre01 kernel]# dmesg | grep Memory
Memory: 643148k/655360k available (2331k kernel code, 11424k reserved,
730k data, 348k init, 0k highmem)

[root@tigre01 proc]# ls -l /proc | grep kcore
-r-------- 1 root root 1073692672 Aug 10 21:43 kcore
[root@tigre01 proc]#

Is it a bug or just a new behaviour of the /proc/kcore?

Regards,
R?mi


2003-08-10 21:16:54

by Remi Colinet

[permalink] [raw]
Subject: Re: 2.6.0-test2 : size of /proc/kcore is different from RAM size.

R?mi Colinet wrote:

> Hi,
>
> I have noticed that the /proc/kcore file has a different size (1Go)
> compared with the available memory of my box (640Mo).
>
> [root@tigre01 kernel]# dmesg | grep Memory
> Memory: 643148k/655360k available (2331k kernel code, 11424k reserved,
> 730k data, 348k init, 0k highmem)
>
> [root@tigre01 proc]# ls -l /proc | grep kcore
> -r-------- 1 root root 1073692672 Aug 10 21:43 kcore
> [root@tigre01 proc]#
>
> Is it a bug or just a new behaviour of the /proc/kcore?
>
> Regards,
> R?mi

It's ok with 2.6.0-test3-mm1.

Remi





2003-08-13 17:00:32

by Luck, Tony

[permalink] [raw]
Subject: Re: 2.6.0-test2 : size of /proc/kcore is different from RAM size.

> I have noticed that the /proc/kcore file has a different size (1Go)
> compared with the available memory of my box (640Mo).
>
> [root@tigre01 kernel]# dmesg | grep Memory
> Memory: 643148k/655360k available (2331k kernel code, 11424k reserved,
> 730k data, 348k init, 0k highmem)
>
> [root@tigre01 proc]# ls -l /proc | grep kcore
> -r-------- 1 root root 1073692672 Aug 10 21:43 kcore
> [root@tigre01 proc]#
>
> Is it a bug or just a new behaviour of the /proc/kcore?

New behaivour ... /proc/kcore is a pseudo-file that tries to
look as much like a "core" file as possible. For architectures
that use ELF executable format, this means that it starts with
an ELF header, then a few elf_phdr structures to describe the
various virtual sections, and then the sections themselves. You
can use "objdump -fp" to display these in human readable form.

/proc/kcore will usually be somewhat sparse, as the offsets chosen
for the sections within the file depend on the virtual addresses
of the sections in kernel virtual memory.

The size of the file should be large enough to cover all of the
sections. One glitch, that probably ought to be fixed, is that
the size is initially assigned based on memory size, but the first
time the file is opened we compute the correct size for all the
sections.

-Tony Luck