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))); } _______________________________________________ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"