Subject: Re: [vserver] RSS memory counter
From: Lukasz Czarnowski <relaks@o2.pl>
Date: Tue, 17 Jun 2008 20:43:50 +0200

On Tue, 17 Jun 2008 18:44:54 +0200
Herbert Poetzl <herbert@13thfloor.at> wrote:

> On Thu, May 01, 2008 at 04:01:30PM +0200, Lukasz Czarnowski wrote:
> > Hi all!
> > 
> > 	I have discovered small problem - IMHO RSS memory counter work incorrectly.
> > If postgresql is running on a vserver:



If I set flag VIRT_MEM - `free' show 2698668kB memory is used:

> > # vattribute --xid 40003 --set --flag virt_mem
> > 
> > # vserver test exec free
> >              total       used       free     shared    buffers     cached
> > Mem:      12338224    2698668    9639556          0          0          0
> > -/+ buffers/cache:    2698668    9639556
                          ^^^^^^^


Else, if I unset flag VIRT_MEM - `free' show 395152kB memory is used:

> > # vattribute --xid 40003 --set --flag ~virt_mem
> > 
> > # vserver test exec free
> >              total       used       free     shared    buffers     cached
> > Mem:      12338224   10658056    1680168          0      19576   10243328
> > -/+ buffers/cache:     395152   11943072
                           ^^^^^^

and I see the real memory usage (not multipled, 395152kB vs 2698668kB). 

[...]

> 
> please elaborate what you are seeing ...

I add the comment.


> > IMO memory pages mapped in multiple (postmaster) processes are counted
> > multiple times. Bug or feature? Any hints?
> 
> are they shared read only or mapped in a way that they
> get copied on write?

SHM

Please read this message:

http://lkml.org/lkml/2007/2/9/275

and:

http://www.nabble.com/configurability-of-OOM-killer-td15236655.html

	
Thank you for your reply.

Regards,
-- 
Lukasz Czarnowski
relaks@ciach_o2.pl