Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 12 Feb 2011 02:10:08 +0000 (UTC)
From:      Juli Mallett <jmallett@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r218592 - head/sys/vm
Message-ID:  <201102120210.p1C2A8Ej081499@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jmallett
Date: Sat Feb 12 02:10:08 2011
New Revision: 218592
URL: http://svn.freebsd.org/changeset/base/218592

Log:
  Use CPU_FOREACH rather than expecting CPUs 0 through mp_ncpus-1 to be present.
  Don't micro-optimize the uniprocessor case; use the same loop there.
  
  Submitted by:	Bhanu Prakash
  Reviewed by:	kib, jhb

Modified:
  head/sys/vm/vm_meter.c

Modified: head/sys/vm/vm_meter.c
==============================================================================
--- head/sys/vm/vm_meter.c	Sat Feb 12 02:08:24 2011	(r218591)
+++ head/sys/vm/vm_meter.c	Sat Feb 12 02:10:08 2011	(r218592)
@@ -254,16 +254,12 @@ vcnt(SYSCTL_HANDLER_ARGS)
 {
 	int count = *(int *)arg1;
 	int offset = (char *)arg1 - (char *)&cnt;
-#ifdef SMP
 	int i;
 
-	for (i = 0; i < mp_ncpus; ++i) {
+	CPU_FOREACH(i) {
 		struct pcpu *pcpu = pcpu_find(i);
 		count += *(int *)((char *)&pcpu->pc_cnt + offset);
 	}
-#else
-	count += *(int *)((char *)PCPU_PTR(cnt) + offset);
-#endif
 	return (SYSCTL_OUT(req, &count, sizeof(int)));
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201102120210.p1C2A8Ej081499>