diff options
author | jeff <jeff@FreeBSD.org> | 2004-02-01 02:51:33 +0000 |
---|---|---|
committer | jeff <jeff@FreeBSD.org> | 2004-02-01 02:51:33 +0000 |
commit | adc4a3ea82ac1a67aeaa4d2ae9ece8028e1a9a3b (patch) | |
tree | 3c5d986ce990e675be6b17945525046931a52372 /sys/kern/kern_synch.c | |
parent | 201544a2b65d8dcf48483b4d2ddc5674f31a316e (diff) | |
download | FreeBSD-src-adc4a3ea82ac1a67aeaa4d2ae9ece8028e1a9a3b.zip FreeBSD-src-adc4a3ea82ac1a67aeaa4d2ae9ece8028e1a9a3b.tar.gz |
- Use sched_load() rather than grabbing the sx lock and traversing the proc
table to discover the load.
Diffstat (limited to 'sys/kern/kern_synch.c')
-rw-r--r-- | sys/kern/kern_synch.c | 22 |
1 files changed, 2 insertions, 20 deletions
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c index 7ddd49b..cf691bf 100644 --- a/sys/kern/kern_synch.c +++ b/sys/kern/kern_synch.c @@ -586,28 +586,10 @@ loadav(void) { int i, nrun; struct loadavg *avg; - struct proc *p; - struct thread *td; + nrun = sched_load(); avg = &averunnable; - sx_slock(&allproc_lock); - nrun = 0; - FOREACH_PROC_IN_SYSTEM(p) { - FOREACH_THREAD_IN_PROC(p, td) { - switch (td->td_state) { - case TDS_RUNQ: - case TDS_RUNNING: - if ((p->p_flag & P_NOLOAD) != 0) - goto nextproc; - nrun++; /* XXXKSE */ - default: - break; - } -nextproc: - continue; - } - } - sx_sunlock(&allproc_lock); + for (i = 0; i < 3; i++) avg->ldavg[i] = (cexp[i] * avg->ldavg[i] + nrun * FSCALE * (FSCALE - cexp[i])) >> FSHIFT; |