From gslin@ccbsd3.csie.nctu.edu.tw  Thu Jun  8 07:04:13 2006
Return-Path: <gslin@ccbsd3.csie.nctu.edu.tw>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id AD50116FD7C
	for <FreeBSD-gnats-submit@freebsd.org>; Thu,  8 Jun 2006 04:34:17 +0000 (UTC)
	(envelope-from gslin@ccbsd3.csie.nctu.edu.tw)
Received: from ccbsd3.csie.nctu.edu.tw (ccbsd3.csie.nctu.edu.tw [140.113.209.63])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 3373143D48
	for <FreeBSD-gnats-submit@freebsd.org>; Thu,  8 Jun 2006 04:34:16 +0000 (GMT)
	(envelope-from gslin@ccbsd3.csie.nctu.edu.tw)
Received: from ccbsd3.csie.nctu.edu.tw (gslin@localhost.csie.nctu.edu.tw [127.0.0.1])
	by ccbsd3.csie.nctu.edu.tw (8.13.6/8.13.6) with ESMTP id k584YH5c015481;
	Thu, 8 Jun 2006 12:34:17 +0800 (CST)
	(envelope-from gslin@ccbsd3.csie.nctu.edu.tw)
Received: (from gslin@localhost)
	by ccbsd3.csie.nctu.edu.tw (8.13.6/8.13.6/Submit) id k584YHNK015480;
	Thu, 8 Jun 2006 12:34:17 +0800 (CST)
	(envelope-from gslin)
Message-Id: <200606080434.k584YHNK015480@ccbsd3.csie.nctu.edu.tw>
Date: Thu, 8 Jun 2006 12:34:17 +0800 (CST)
From: Gea-Suan Lin <gslin@csie.nctu.edu.tw>
Reply-To: Gea-Suan Lin <gslin@csie.nctu.edu.tw>
To: FreeBSD-gnats-submit@freebsd.org
Cc: gslin@csie.nctu.edu.tw
Subject: Reduce NIS server loading
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         98693
>Category:       bin
>Synopsis:       [patch] top(1): Reduce NIS server loading
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jun 08 07:10:11 GMT 2006
>Closed-Date:    Fri May 04 18:36:42 GMT 2007
>Last-Modified:  Fri May 04 18:36:42 GMT 2007
>Originator:     Gea-Suan Lin
>Release:        FreeBSD 6.1-STABLE i386
>Organization:
>Environment:
System: FreeBSD ccbsd3.csie.nctu.edu.tw 6.1-STABLE FreeBSD 6.1-STABLE #2: Thu Jun 8 06:24:03 CST 2006 root@ccbsd3.csie.nctu.edu.tw:/usr/obj/usr/src/sys/CCBSD3 i386


	
>Description:
	
If there are a lot of users (> 10k) in NIS, then running top causes
NIS server high load.

>How-To-Repeat:
	
>Fix:
	

--- /usr/src/usr.bin/top/machine.c	Wed May 18 21:42:51 2005
+++ machine.c	Thu Jun  8 12:32:56 2006
@@ -62,7 +62,7 @@
 int swapmode(int *retavail, int *retfree);
 static int smpmode;
 enum displaymodes displaymode;
-static int namelength = 8;
+static int namelength = UPUNAMELEN;
 static int cmdlengthdelta;
 
 /* Prototypes for top internals */
@@ -235,14 +235,8 @@
 	    modelen != sizeof(smpmode))
 		smpmode = 0;
 
-	while ((pw = getpwent()) != NULL) {
-		if (strlen(pw->pw_name) > namelength)
-			namelength = strlen(pw->pw_name);
-	}
 	if (smpmode && namelength > SMPUNAMELEN)
 		namelength = SMPUNAMELEN;
-	else if (namelength > UPUNAMELEN)
-		namelength = UPUNAMELEN;
 
 	kd = kvm_open(NULL, _PATH_DEVNULL, NULL, O_RDONLY, "kvm_open");
 	if (kd == NULL)
>Release-Note:
>Audit-Trail:

From: Gavin Atkinson <gavin.atkinson@ury.york.ac.uk>
To: bug-followup@FreeBSD.org, gslin@csie.nctu.edu.tw
Cc:  
Subject: Re: bin/98693: [patch] top(1): Reduce NIS server loading
Date: Fri, 04 May 2007 16:27:23 +0100

 This is a duplicate of PR bin/20799 and bin/89762 (which contains an
 alternative but possibly more acceptable) patch, and therefore should be
 closed.  Thanks for your submission!
 
 Gavin
State-Changed-From-To: open->closed 
State-Changed-By: remko 
State-Changed-When: Fri May 4 18:36:40 UTC 2007 
State-Changed-Why:  
duplicate of 89762, reported by gavin 

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