From 9f266b0941e7bf6d4bb1085e29c18812a7c34534 Mon Sep 17 00:00:00 2001 From: jeff Date: Wed, 5 Nov 2003 05:30:12 +0000 Subject: - 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. --- sys/kern/sched_ule.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'sys/kern') 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); } -- cgit v1.1