Bug 142994

Summary: Per-process shared memory is greater than resident memory
Product: Red Hat Enterprise Linux 4 Reporter: Lev Makhlis <lev_makhlis>
Component: kernelAssignee: Dave Jones <davej>
Status: CLOSED RAWHIDE QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.0CC: jbaron, pfrields
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
URL: http://linux.bkbits.net:8080/linux-2.5/cset@1.2026.12.193
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-12-15 17:27:02 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Lev Makhlis 2004-12-15 17:08:33 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3)
Gecko/20041020

Description of problem:
Quoting Hugh Dickins:
"The third "shared" field of /proc/$pid/statm in 2.4 was a count of
pages in the mm whose page_count is more than 1 (oddly, including
pages shared just with swapcache).  That's too costly to calculate
each time, so 2.6 changed it to the total file-backed extent.  But
Andrea knows apps and users surprised when (rss - shared) goes
negative: we need to provide an rss-like statistic, close to the 2.4
interpretation.

Something that's quick and easy to maintain accurately is
mm->anon_rss, the count of anonymous pages in the mm.  Then shared =
rss - anon_rss gives a pretty good and meaningful approximation to
2.4's intention: wli confirms that this will be useful to Oracle too."

Version-Release number of selected component (if applicable):
2.6.9-1.675_EL

How reproducible:
Always

Steps to Reproduce:
1. Run "top"

    

Actual Results:    PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM  
 TIME+  COMMAND
 3098 root      17   0  3292  924 1664 R  1.0  0.5   0:01.11 top


Expected Results:  SHR < RES

Additional info:

Please consider merging Hugh's patches from 2.6.10-rc2:
http://linux.bkbits.net:8080/linux-2.5/cset@1.2026.12.193
http://linux.bkbits.net:8080/linux-2.5/cset@1.2026.12.194

Comment 1 Jason Baron 2004-12-15 17:27:02 UTC
these have been merged already. thanks.