2001-02-12 06:38:42

by Brian Grossman

[permalink] [raw]
Subject: sysinfo.sharedram not accounted for on i386 ?


On i386, sysinfo.sharedram is not accounted for, leading /proc/meminfo to
always report MemShared as 0. Is this the intended behavior?

Brian


2001-02-12 11:02:54

by Erik Mouw

[permalink] [raw]
Subject: Re: sysinfo.sharedram not accounted for on i386 ?

On Mon, Feb 12, 2001 at 12:05:03AM -0700, Brian Grossman wrote:
> On i386, sysinfo.sharedram is not accounted for, leading /proc/meminfo to
> always report MemShared as 0. Is this the intended behavior?

Yes.


Erik

--
J.A.K. (Erik) Mouw, Information and Communication Theory Group, Department
of Electrical Engineering, Faculty of Information Technology and Systems,
Delft University of Technology, PO BOX 5031, 2600 GA Delft, The Netherlands
Phone: +31-15-2783635 Fax: +31-15-2781843 Email: [email protected]
WWW: http://www-ict.its.tudelft.nl/~erik/

2001-02-12 12:26:56

by Brian Grossman

[permalink] [raw]
Subject: Re: sysinfo.sharedram not accounted for on i386 ?


> On Mon, Feb 12, 2001 at 12:05:03AM -0700, Brian Grossman wrote:
> > On i386, sysinfo.sharedram is not accounted for, leading /proc/meminfo to
> > always report MemShared as 0. Is this the intended behavior?
>
> Yes.

Thanks. Is there a preferred way of getting the equivalent info
as free(1) did under 2.2?

I've written a script to derive it from /proc/[0-9]*/statm, but that seems
like an awkward approach. A related question: is the page size stored in
/proc somewhere?

Is there a discussion of this somewhere? I couldn't find one when I
searched the linux-kernel archives.

Brian

2001-02-12 12:44:23

by Tigran Aivazian

[permalink] [raw]
Subject: Re: sysinfo.sharedram not accounted for on i386 ?

On Mon, 12 Feb 2001, Brian Grossman wrote:
> > Yes.
>
> Thanks. Is there a preferred way of getting the equivalent info
> as free(1) did under 2.2?

btw, this is not only x86 behaviour but is also true on all other
architectures. I.e. Linux defines "shared memory" as a "integer constant
with value 0". So, to say "zero" is just a shorter form of saying "Linux
concept of shared memory". However, remember that if you are interested in
shared _pages_, that information is available and is not identically 0.
See the show_mem() function in arch/i386/mm/init.c.

>
> I've written a script to derive it from /proc/[0-9]*/statm, but that seems
> like an awkward approach. A related question: is the page size stored in
> /proc somewhere?

No, PAGE_SIZE is known at compile time and cannot ever change (especially
it cannot change ig you stay within i386 architecture). It is available to
programs by including <asm/page.h> header.

Tigran

2001-02-12 15:00:21

by Alan

[permalink] [raw]
Subject: Re: sysinfo.sharedram not accounted for on i386 ?

> > like an awkward approach. A related question: is the page size stored in
> > /proc somewhere?
>
> No, PAGE_SIZE is known at compile time and cannot ever change (especially
> it cannot change ig you stay within i386 architecture). It is available to
> programs by including <asm/page.h> header.

Untrue. On many architectures page size is not fixed. You should use the
getpagesize() function/syscall. glibc knows if its a syscall or a constant
you dont