summaryrefslogtreecommitdiffstats
path: root/sys/kern/sys_generic.c
diff options
context:
space:
mode:
authorjeff <jeff@FreeBSD.org>2007-06-05 00:00:57 +0000
committerjeff <jeff@FreeBSD.org>2007-06-05 00:00:57 +0000
commit91d150179059555ef497f4b5b5a560fdb24e472f (patch)
tree6727b982fa0d93b8aafab313bdc797aee9e314d2 /sys/kern/sys_generic.c
parent8297f778b9d0a595a99ca58d332ab4111b636019 (diff)
downloadFreeBSD-src-91d150179059555ef497f4b5b5a560fdb24e472f.zip
FreeBSD-src-91d150179059555ef497f4b5b5a560fdb24e472f.tar.gz
Commit 14/14 of sched_lock decomposition.
- Use thread_lock() rather than sched_lock for per-thread scheduling sychronization. - Use the per-process spinlock rather than the sched_lock for per-process scheduling synchronization. Tested by: kris, current@ Tested on: i386, amd64, ULE, 4BSD, libthr, libkse, PREEMPTION, etc. Discussed with: kris, attilio, kmacy, jhb, julian, bde (small parts each)
Diffstat (limited to 'sys/kern/sys_generic.c')
-rw-r--r--sys/kern/sys_generic.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c
index 5004460..992d181 100644
--- a/sys/kern/sys_generic.c
+++ b/sys/kern/sys_generic.c
@@ -722,9 +722,9 @@ kern_select(struct thread *td, int nd, fd_set *fd_in, fd_set *fd_ou,
mtx_lock(&sellock);
retry:
ncoll = nselcoll;
- mtx_lock_spin(&sched_lock);
+ thread_lock(td);
td->td_flags |= TDF_SELECT;
- mtx_unlock_spin(&sched_lock);
+ thread_unlock(td);
mtx_unlock(&sellock);
error = selscan(td, ibits, obits, nd);
@@ -747,12 +747,12 @@ retry:
* collisions and rescan the file descriptors if
* necessary.
*/
- mtx_lock_spin(&sched_lock);
+ thread_lock(td);
if ((td->td_flags & TDF_SELECT) == 0 || nselcoll != ncoll) {
- mtx_unlock_spin(&sched_lock);
+ thread_unlock(td);
goto retry;
}
- mtx_unlock_spin(&sched_lock);
+ thread_unlock(td);
if (timo > 0)
error = cv_timedwait_sig(&selwait, &sellock, timo);
@@ -764,9 +764,9 @@ retry:
done:
clear_selinfo_list(td);
- mtx_lock_spin(&sched_lock);
+ thread_lock(td);
td->td_flags &= ~TDF_SELECT;
- mtx_unlock_spin(&sched_lock);
+ thread_unlock(td);
mtx_unlock(&sellock);
done_nosellock:
@@ -896,9 +896,9 @@ poll(td, uap)
mtx_lock(&sellock);
retry:
ncoll = nselcoll;
- mtx_lock_spin(&sched_lock);
+ thread_lock(td);
td->td_flags |= TDF_SELECT;
- mtx_unlock_spin(&sched_lock);
+ thread_unlock(td);
mtx_unlock(&sellock);
error = pollscan(td, bits, nfds);
@@ -919,12 +919,12 @@ retry:
* sellock, so check TDF_SELECT and the number of collisions
* and rescan the file descriptors if necessary.
*/
- mtx_lock_spin(&sched_lock);
+ thread_lock(td);
if ((td->td_flags & TDF_SELECT) == 0 || nselcoll != ncoll) {
- mtx_unlock_spin(&sched_lock);
+ thread_unlock(td);
goto retry;
}
- mtx_unlock_spin(&sched_lock);
+ thread_unlock(td);
if (timo > 0)
error = cv_timedwait_sig(&selwait, &sellock, timo);
@@ -936,9 +936,9 @@ retry:
done:
clear_selinfo_list(td);
- mtx_lock_spin(&sched_lock);
+ thread_lock(td);
td->td_flags &= ~TDF_SELECT;
- mtx_unlock_spin(&sched_lock);
+ thread_unlock(td);
mtx_unlock(&sellock);
done_nosellock:
@@ -1109,9 +1109,9 @@ doselwakeup(sip, pri)
}
TAILQ_REMOVE(&td->td_selq, sip, si_thrlist);
sip->si_thread = NULL;
- mtx_lock_spin(&sched_lock);
+ thread_lock(td);
td->td_flags &= ~TDF_SELECT;
- mtx_unlock_spin(&sched_lock);
+ thread_unlock(td);
sleepq_remove(td, &selwait);
mtx_unlock(&sellock);
}
OpenPOWER on IntegriCloud