diff options
author | jhb <jhb@FreeBSD.org> | 2010-06-11 18:46:34 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2010-06-11 18:46:34 +0000 |
commit | 9b74a62d735d756ad10a232bb6b9bf1d5803a473 (patch) | |
tree | 6823a317037813f606c0b52d6cfa18c924eb9a1d /sys/kern | |
parent | 4945d8d26d66a088d72189bf54f9678981e78766 (diff) | |
download | FreeBSD-src-9b74a62d735d756ad10a232bb6b9bf1d5803a473.zip FreeBSD-src-9b74a62d735d756ad10a232bb6b9bf1d5803a473.tar.gz |
Update several places that iterate over CPUs to use CPU_FOREACH().
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_clock.c | 4 | ||||
-rw-r--r-- | sys/kern/kern_switch.c | 4 | ||||
-rw-r--r-- | sys/kern/kern_timeout.c | 4 | ||||
-rw-r--r-- | sys/kern/sched_4bsd.c | 8 | ||||
-rw-r--r-- | sys/kern/sched_ule.c | 6 | ||||
-rw-r--r-- | sys/kern/subr_lock.c | 4 | ||||
-rw-r--r-- | sys/kern/subr_pcpu.c | 4 | ||||
-rw-r--r-- | sys/kern/subr_smp.c | 5 |
8 files changed, 12 insertions, 27 deletions
diff --git a/sys/kern/kern_clock.c b/sys/kern/kern_clock.c index a35e43b..7e93ddd 100644 --- a/sys/kern/kern_clock.c +++ b/sys/kern/kern_clock.c @@ -318,9 +318,7 @@ read_cpu_time(long *cp_time) /* Sum up global cp_time[]. */ bzero(cp_time, sizeof(long) * CPUSTATES); - for (i = 0; i <= mp_maxid; i++) { - if (CPU_ABSENT(i)) - continue; + CPU_FOREACH(i) { pc = pcpu_find(i); for (j = 0; j < CPUSTATES; j++) cp_time[j] += pc->pc_cp_time[j]; diff --git a/sys/kern/kern_switch.c b/sys/kern/kern_switch.c index 035661f..93cbf7b 100644 --- a/sys/kern/kern_switch.c +++ b/sys/kern/kern_switch.c @@ -133,9 +133,7 @@ sysctl_stats_reset(SYSCTL_HANDLER_ARGS) if (p == oidp || p->oid_arg1 == NULL) continue; counter = (uintptr_t)p->oid_arg1; - for (i = 0; i <= mp_maxid; i++) { - if (CPU_ABSENT(i)) - continue; + CPU_FOREACH(i) { *(long *)(dpcpu_off[i] + counter) = 0; } } diff --git a/sys/kern/kern_timeout.c b/sys/kern/kern_timeout.c index c38888a..78b0949 100644 --- a/sys/kern/kern_timeout.c +++ b/sys/kern/kern_timeout.c @@ -228,11 +228,9 @@ start_softclock(void *dummy) panic("died while creating standard software ithreads"); cc->cc_cookie = softclock_ih; #ifdef SMP - for (cpu = 0; cpu <= mp_maxid; cpu++) { + CPU_FOREACH(cpu) { if (cpu == timeout_cpu) continue; - if (CPU_ABSENT(cpu)) - continue; cc = CC_CPU(cpu); if (swi_add(NULL, "clock", softclock, cc, SWI_CLOCK, INTR_MPSAFE, &cc->cc_cookie)) diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c index 2cdf2c4..61366cd 100644 --- a/sys/kern/sched_4bsd.c +++ b/sys/kern/sched_4bsd.c @@ -1190,9 +1190,7 @@ sched_pickcpu(struct thread *td) best = td->td_lastcpu; else best = NOCPU; - for (cpu = 0; cpu <= mp_maxid; cpu++) { - if (CPU_ABSENT(cpu)) - continue; + CPU_FOREACH(cpu) { if (!THREAD_CAN_SCHED(td, cpu)) continue; @@ -1627,9 +1625,7 @@ sched_affinity(struct thread *td) */ ts = td->td_sched; ts->ts_flags &= ~TSF_AFFINITY; - for (cpu = 0; cpu <= mp_maxid; cpu++) { - if (CPU_ABSENT(cpu)) - continue; + CPU_FOREACH(cpu) { if (!THREAD_CAN_SCHED(td, cpu)) { ts->ts_flags |= TSF_AFFINITY; break; diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index efc4ee9..dcbac78 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -1254,9 +1254,7 @@ sched_setup_smp(void) int i; cpu_top = smp_topo(); - for (i = 0; i < MAXCPU; i++) { - if (CPU_ABSENT(i)) - continue; + CPU_FOREACH(i) { tdq = TDQ_CPU(i); tdq_setup(tdq); tdq->tdq_cg = smp_topo_find(cpu_top, i); @@ -2485,7 +2483,7 @@ sched_load(void) int i; total = 0; - for (i = 0; i <= mp_maxid; i++) + CPU_FOREACH(i) total += TDQ_CPU(i)->tdq_sysload; return (total); #else diff --git a/sys/kern/subr_lock.c b/sys/kern/subr_lock.c index 977f9e5..bc43c9c 100644 --- a/sys/kern/subr_lock.c +++ b/sys/kern/subr_lock.c @@ -256,9 +256,7 @@ lock_prof_idle(void) td = curthread; thread_lock(td); - for (cpu = 0; cpu <= mp_maxid; cpu++) { - if (CPU_ABSENT(cpu)) - continue; + CPU_FOREACH(cpu) { sched_bind(td, cpu); } sched_unbind(td); diff --git a/sys/kern/subr_pcpu.c b/sys/kern/subr_pcpu.c index ef69ff6..24a12ea 100644 --- a/sys/kern/subr_pcpu.c +++ b/sys/kern/subr_pcpu.c @@ -317,9 +317,7 @@ DB_SHOW_COMMAND(dpcpu_off, db_show_dpcpu_off) { int id; - for (id = 0; id <= mp_maxid; id++) { - if (CPU_ABSENT(id)) - continue; + CPU_FOREACH(id) { db_printf("dpcpu_off[%2d] = 0x%jx (+ DPCPU_START = %p)\n", id, (uintmax_t)dpcpu_off[id], (void *)(uintptr_t)(dpcpu_off[id] + DPCPU_START)); diff --git a/sys/kern/subr_smp.c b/sys/kern/subr_smp.c index 45a374e..3e4a2ab 100644 --- a/sys/kern/subr_smp.c +++ b/sys/kern/subr_smp.c @@ -395,9 +395,10 @@ smp_rendezvous_cpus(cpumask_t map, return; } - for (i = 0; i <= mp_maxid; i++) - if (((1 << i) & map) != 0 && !CPU_ABSENT(i)) + CPU_FOREACH(i) { + if (((1 << i) & map) != 0) ncpus++; + } if (ncpus == 0) panic("ncpus is 0 with map=0x%x", map); |