mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-06 17:18:32 +00:00
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
This commit is contained in:
parent
1591f3f18c
commit
6edf6104a9
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=218592
|
@ -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)));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue