summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_subr.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2004-02-27 18:52:44 +0000
committerjhb <jhb@FreeBSD.org>2004-02-27 18:52:44 +0000
commitd25301c8586567f23a4a1420292fec042e6496e1 (patch)
tree9be3a10cadbedab600bc4afc5e50485db5af931f /sys/kern/vfs_subr.c
parentd76d63171193672c7e6a895b24e49e7276837c3b (diff)
downloadFreeBSD-src-d25301c8586567f23a4a1420292fec042e6496e1.zip
FreeBSD-src-d25301c8586567f23a4a1420292fec042e6496e1.tar.gz
Switch the sleep/wakeup and condition variable implementations to use the
sleep queue interface: - Sleep queues attempt to merge some of the benefits of both sleep queues and condition variables. Having sleep qeueus in a hash table avoids having to allocate a queue head for each wait channel. Thus, struct cv has shrunk down to just a single char * pointer now. However, the hash table does not hold threads directly, but queue heads. This means that once you have located a queue in the hash bucket, you no longer have to walk the rest of the hash chain looking for threads. Instead, you have a list of all the threads sleeping on that wait channel. - Outside of the sleepq code and the sleep/cv code the kernel no longer differentiates between cv's and sleep/wakeup. For example, calls to abortsleep() and cv_abort() are replaced with a call to sleepq_abort(). Thus, the TDF_CVWAITQ flag is removed. Also, calls to unsleep() and cv_waitq_remove() have been replaced with calls to sleepq_remove(). - The sched_sleep() function no longer accepts a priority argument as sleep's no longer inherently bump the priority. Instead, this is soley a propery of msleep() which explicitly calls sched_prio() before blocking. - The TDF_ONSLEEPQ flag has been dropped as it was never used. The associated TDF_SET_ONSLEEPQ and TDF_CLR_ON_SLEEPQ macros have also been dropped and replaced with a single explicit clearing of td_wchan. TD_SET_ONSLEEPQ() would really have only made sense if it had taken the wait channel and message as arguments anyway. Now that that only happens in one place, a macro would be overkill.
Diffstat (limited to 'sys/kern/vfs_subr.c')
-rw-r--r--sys/kern/vfs_subr.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 9897c22..616791d 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$");
#include <sys/malloc.h>
#include <sys/mount.h>
#include <sys/namei.h>
+#include <sys/sleepqueue.h>
#include <sys/stat.h>
#include <sys/sysctl.h>
#include <sys/syslog.h>
@@ -1598,13 +1599,7 @@ speedup_syncer()
int ret = 0;
td = FIRST_THREAD_IN_PROC(updateproc);
- mtx_lock_spin(&sched_lock);
- if (td->td_wchan == &lbolt) {
- unsleep(td);
- TD_CLR_SLEEPING(td);
- setrunnable(td);
- }
- mtx_unlock_spin(&sched_lock);
+ sleepq_remove(td, &lbolt);
mtx_lock(&sync_mtx);
if (rushjob < syncdelay / 2) {
rushjob += 1;
OpenPOWER on IntegriCloud