From nobody@FreeBSD.org  Wed Jan 23 01:12:49 2002
Return-Path: <nobody@FreeBSD.org>
Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21])
	by hub.freebsd.org (Postfix) with ESMTP id 374CC37B416
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 23 Jan 2002 01:12:49 -0800 (PST)
Received: (from nobody@localhost)
	by freefall.freebsd.org (8.11.6/8.11.6) id g0N9Cn694978;
	Wed, 23 Jan 2002 01:12:49 -0800 (PST)
	(envelope-from nobody)
Message-Id: <200201230912.g0N9Cn694978@freefall.freebsd.org>
Date: Wed, 23 Jan 2002 01:12:49 -0800 (PST)
From: "Samuel J. Greear" <dragonk@evilcode.net>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [PATCH] top(1) RES/rss display incorrect
X-Send-Pr-Version: www-1.0

>Number:         34199
>Category:       bin
>Synopsis:       [PATCH] top(1) RES/rss display incorrect
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    dwmalone
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jan 23 01:20:01 PST 2002
>Closed-Date:    Fri Mar 02 01:25:18 GMT 2007
>Last-Modified:  Fri Mar 02 01:25:18 GMT 2007
>Originator:     Samuel J. Greear
>Release:        5.0-CURRENT
>Organization:
>Environment:
FreeBSD larrikin.evilcode.net 5.0-CURRENT FreeBSD 5.0-CURRENT #2: Tue Jan 22 22:48:56 GMT 2002     root@larrikin.evilcode.net:/usr/src/sys/i386/compile/DK  i386
>Description:
Due to KSE changes in kern_proc.c (rev 1.101) the member of kinfo_proc, ki_rssize no longer needs to be munged after retrieval to be accurate.  See /bin/ps/print.c, rev 1.50.  "UPAGES as a constant is gone in KSE.  We are going to have to trust and/or fix ki_rssize".

Whitespace in attached patch is hosed, see:
http://evilcode.net/patches/top-rss.diff
>How-To-Repeat:
      
>Fix:
--- machine.c.orig      Wed Jan 23 01:59:21 2002
+++ machine.c   Wed Jan 23 01:59:57 2002
@@ -574,7 +574,7 @@
                    (PRIO_MIN - 1 - (PRI_MAX_REALTIME - pp->ki_pri.pri_level)) :
                    (PRIO_MAX + 1 + pp->ki_pri.pri_level - PRI_MIN_IDLE))), 
            format_k2(PROCSIZE(pp)),
-           format_k2(pagetok(pp->ki_rssize)),
+           format_k2(pp->ki_rssize),
            status,
            smpmode ? pp->ki_lastcpu : 0,
            format_time(cputime),

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->dwmalone 
Responsible-Changed-By: dwmalone 
Responsible-Changed-When: Wed Jan 23 01:43:57 PST 2002 
Responsible-Changed-Why:  
I've a few jobs to do on top, so I'll take a look at this. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=34199 

From: Bruce Evans <bde@zeta.org.au>
To: "Samuel J. Greear" <dragonk@evilcode.net>
Cc: <freebsd-gnats-submit@FreeBSD.ORG>
Subject: Re: bin/34199: [PATCH] top(1) RES/rss display incorrect
Date: Mon, 28 Jan 2002 09:12:29 +1100 (EST)

 On Wed, 23 Jan 2002, Samuel J. Greear wrote:
 
 > >Description:
 > Due to KSE changes in kern_proc.c (rev 1.101) the member of kinfo_proc, ki_rssize no longer needs to be munged after retrieval to be accurate.  See /bin/ps/print.c, rev 1.50.  "UPAGES as a constant is gone in KSE.  We are going to have to trust and/or fix ki_rssize".
 
 No changes to top(1) are necessary.  top(1) never had the ki_rssize
 munging, so it used to give wrong values.  The kernel change fixes this.
 
 > >Fix:
 > --- machine.c.orig      Wed Jan 23 01:59:21 2002
 > +++ machine.c   Wed Jan 23 01:59:57 2002
 > @@ -574,7 +574,7 @@
 >                     (PRIO_MIN - 1 - (PRI_MAX_REALTIME - pp->ki_pri.pri_level)) :
 >                     (PRIO_MAX + 1 + pp->ki_pri.pri_level - PRI_MIN_IDLE))),
 >             format_k2(PROCSIZE(pp)),
 > -           format_k2(pagetok(pp->ki_rssize)),
 > +           format_k2(pp->ki_rssize),
 >             status,
 >             smpmode ? pp->ki_lastcpu : 0,
 >             format_time(cputime),
 
 This mungs ki_rssize in a completely different, completely broken way.
 It prints RSS's that are wrong by a factor of getpagesize()/1024.
 
 Bruce
 
State-Changed-From-To: open->closed 
State-Changed-By: linimon 
State-Changed-When: Fri Mar 2 01:24:09 UTC 2007 
State-Changed-Why:  
top has been reworked many times since this PR originally came in.  Thanks 
for the report, anyway. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=34199 
>Unformatted:
