[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: "ps -o %mem" and free memory in Linux



Klaus Singvogel wrote:
> Victor Sudakov wrote:
> > > Perhaps because the php-fpm workers were forked from the same parent
> > > and so a lot of theie 'physical' RAM is actually the same RAM as each
> > > other, because it's not been modified?
> > 
> > I see your point, but ps(1) talks about real physical RAM:
> > 
> > %mem        %MEM      ratio of the process's resident set size  to the physical memory on the machine, expressed as a percentage.  (alias pmem).
> > 
> > If those php-fpm workers share a lot of virtual (?) memory between one
> > another, shouldn't `ps` show it as such?
> 
> You sum up this:
> 
> < php-fpm individual 1><----   php-fpm   ----   shared  ---->
> < php-fpm individual 2><----   php-fpm   ----   shared  ---->
> ...
> < php-fpm individual n><----   php-fpm   ----   shared  ---->
> 
> You summed up with awk: indivual[1..n] + n * shared

I summed up with awk the values of %mem, which are supposed to be "ratio
of the process's resident set size  to the physical memory", correct?

In my understanding, the value of %mem should indicate how much physical
memory is spent on the "individual" part of the process, otherwise the
parameter is either useless or misdocumented.

> 
> But the real memory sum is:  indivual[1..n] + 1 * shared
> 
> Do you see the difference?

I see your point but still don't understand how that comes from the
definition of "%mem" in the man page.

-- 
Victor Sudakov,  VAS4-RIPE, VAS47-RIPN
2:5005/49@fidonet http://vas.tomsk.ru/

Attachment: signature.asc
Description: PGP signature


Reply to: