Subject: Re: strange low RSS sizes
To: Matthias Buelow <mkb@mukappabeta.de>
From: Chuck Silvers <chuq@chuq.com>
List: port-sparc
Date: 12/15/2001 01:13:13
--h31gzZEtNLTqOjlF
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

hi,

I just checked in the attached fix for this to -current,
and I'll submit it for inclusion in 1.5.3 tomorrow.

-Chuck


On Sat, Dec 15, 2001 at 03:47:23AM +0100, Matthias Buelow wrote:
> Hi,
> 
> I'm running 1.5.2 on a Sparcstation 5 and am somewhat amused at the
> RSS (resident set size) memory consumption sizes that ps, top etc.
> report.  In fact, they seem to be very low.  I'm not running a
> desynched kernel<->userland combo, it was the same on the 1.5.2
> generic kernel right after installation, aswell as on those that
> I built since.  Just have a look at that:
> 
> USER  PID %CPU %MEM VSZ RSS TT STAT STARTED   TIME COMMAND
> mkb  6920 28.3  0.1 372 168 p1 T     3:42AM 0:01.14 /usr/pkg/lib/sml-nj/bin/.run
> mkb  6925  0.0  0.1 448  80 p1 R+    3:42AM 0:00.01 ps ux 
> mkb  3871  0.0  0.0 388  40 p2 S+    3:01AM 0:00.12 screen (screen-3.9.10)
> [...]
> 
> The entry containing "sml" above is Standard ML of New Jersey; the
> interactive top level system of a relatively memory-hungry functional
> programming language, right after start, on i386 it reports more than
> 8 megs RSS in use:
> 
> mkb  1164  0.0  3.4   336  8864 p3 T     3:40AM 0:00.09 /usr/pkg/lib/sml-nj/bin
> 
> All other values seem to be far too low aswell.
> I have 86MB core free on the sparc still and no swap is in use.
> Is this a known quirk, or do I have to send-pr?
> 
> --mkb

--h31gzZEtNLTqOjlF
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="diff.sparc-pmap_res"

Index: arch/sparc/sparc/pmap.c
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/sparc/sparc/pmap.c,v
retrieving revision 1.200
diff -u -r1.200 pmap.c
--- arch/sparc/sparc/pmap.c	2001/12/04 00:05:07	1.200
+++ arch/sparc/sparc/pmap.c	2001/12/15 08:38:09
@@ -7123,7 +7123,7 @@
 pmap_count_ptes(pm)
 	struct pmap *pm;
 {
-	int idx, total;
+	int idx, vs, total;
 	struct regmap *rp;
 	struct segmap *sp;
 
@@ -7134,9 +7134,14 @@
 		rp = pm->pm_regmap;
 		idx = NUREG;
 	}
-	for (total = 0; idx;)
-		if ((sp = rp[--idx].rg_segmap) != NULL)
-			total += sp->sg_npte;
+	for (total = 0; idx;) {
+		if ((sp = rp[--idx].rg_segmap) == NULL) {
+			continue;
+		}
+		for (vs = 0; vs < NSEGRG; vs++) {
+			total += sp[vs].sg_npte;
+		}
+	}
 	pm->pm_stats.resident_count = total;
 	return (total);
 }

--h31gzZEtNLTqOjlF--