diff options
author | jmallett <jmallett@FreeBSD.org> | 2011-02-12 02:10:08 +0000 |
---|---|---|
committer | jmallett <jmallett@FreeBSD.org> | 2011-02-12 02:10:08 +0000 |
commit | 77919e089a1101ba33c3fb8e256420350b3fd217 (patch) | |
tree | 3d91d9424da815d5dc70263081d70fce1d6aced3 /sys/vm | |
parent | 43ee1f2df30c3b8c4c3bbf22918455c6e0032535 (diff) | |
download | FreeBSD-src-77919e089a1101ba33c3fb8e256420350b3fd217.zip FreeBSD-src-77919e089a1101ba33c3fb8e256420350b3fd217.tar.gz |
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
Diffstat (limited to 'sys/vm')
-rw-r--r-- | sys/vm/vm_meter.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/sys/vm/vm_meter.c b/sys/vm/vm_meter.c index fb098ea..e0f7e32 100644 --- a/sys/vm/vm_meter.c +++ b/sys/vm/vm_meter.c @@ -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))); } |