summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorjeff <jeff@FreeBSD.org>2003-11-05 05:30:12 +0000
committerjeff <jeff@FreeBSD.org>2003-11-05 05:30:12 +0000
commit9f266b0941e7bf6d4bb1085e29c18812a7c34534 (patch)
tree6e04897254a32dae5e2b74623c8d64ee1079d867 /sys/kern
parent6e26b88350819d423f90d57667f1c148bc042f55 (diff)
downloadFreeBSD-src-9f266b0941e7bf6d4bb1085e29c18812a7c34534.zip
FreeBSD-src-9f266b0941e7bf6d4bb1085e29c18812a7c34534.tar.gz
- It's ok if sched_runnable() has races in it, we don't need the sched_lock
here unless we have something on the assigned queue.
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/sched_ule.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c
index 73ed185..545fa4a 100644
--- a/sys/kern/sched_ule.c
+++ b/sys/kern/sched_ule.c
@@ -1239,11 +1239,13 @@ sched_runnable(void)
load = 1;
- mtx_lock_spin(&sched_lock);
kseq = KSEQ_SELF();
#ifdef SMP
- if (kseq->ksq_assigned)
+ if (kseq->ksq_assigned) {
+ mtx_lock_spin(&sched_lock);
kseq_assign(kseq);
+ mtx_unlock_spin(&sched_lock);
+ }
#endif
if ((curthread->td_flags & TDF_IDLETD) != 0) {
if (kseq->ksq_load > 0)
@@ -1253,7 +1255,6 @@ sched_runnable(void)
goto out;
load = 0;
out:
- mtx_unlock_spin(&sched_lock);
return (load);
}
OpenPOWER on IntegriCloud