Re: [mp2] Apache2::SizeLimit should be using $s->rss, not $s->size for Linux::Smaps

Max Kanat-Alexander <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Organization Bugzilla Project
Message-ID <[email protected]>
	So, I just recently installed the very latest release of SizeLimit, and
this is still a problem. SizeLimit **definitely** returns the wrong
unshared size for processes on any modern Linux system.

	-Max

On 02/03/2010 12:05 PM, Max Kanat-Alexander wrote:
> On 02/03/2010 04:57 AM, Torsten Förtsch wrote:
>> Well, I tend to disagree. (Fred, Adam please read on.)
> 
> 	Okay. Have you looked at the actual output of test.cgi?
> 
> 	Here's an example of these values just on my local machine, for my bash
> interpreter:
> 
> [mkanat@es-compy ~]$ cat /proc/self/statm
> 21045 125 107 13 0 65 0
> [mkanat@es-compy ~]$ cat /proc/self/status | grep Vm
> VmPeak:	   84180 kB
> VmSize:	   84180 kB
> VmLck:	       0 kB
> VmHWM:	     496 kB
> VmRSS:	     496 kB
> VmData:	     176 kB
> VmStk:	      84 kB
> VmExe:	      52 kB
> VmLib:	    1548 kB
> VmPTE:	      48 kB
> 
> 	Would you consider that bash is taking up 84MB, or would you consider
> it's taking up 496KB? I have 2GB in physical RAM and 2GB in swap. So,
> theoretically, I should only be able to open 48 terminals before I OOM.
> With 60 terminals open, here's the result of "free":
> 
>              total       used       free
> Mem:          1990       1855        134
> -/+ buffers/cache:       1140        850
> Swap:         1999        212       1787
> 
> 	If I were simply to add up the "Virt" column of the top 15 processes in
> "top" on my machine, I'd be using somewhere in the vicinity of 20GB of RAM.
> 
>> So, either the far older statm technique is also wrong or the patch is wrong.
> 
> 	I would suspect that if you're using column 0 as the size, then statm
> is also indeed wrong.
> 
>> =item * Apache2::SizeLimit->set_max_process_size($size)
>>
>> This sets the maximum size of the process, including both shared and
>> unshared memory.
> 
> 	Ahh, but look at the output of both the "shared" and "private"
> accessors, and they do not add up to VmSize. They add up to RSS.
> 
>> Perhaps Apache2::SizeLimit::Core should read:
>>
>> sub _check_size {
>>     my $class = shift;
>>
>>     my ($size, $share, $unshared) = $class->_platform_check_size();
>>
>>     return ($size, $share, defined $unshared ? $unshared : $size - $share);
> 
> 	That would certainly help (because then you would get a more accurate
> count of the current private RSS), although I'd argue that VmSize is
> still meaningless. I can imagine few instances where you'd want to know
> the total size of the address space of a process, even if most of it had
> never been mapped to an actual memory page.
> 
> 	-Max


-- 
http://www.bugzillasource.com/
Competent, Friendly Bugzilla, Perl, and IT Services
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.