diff options
author | John Baldwin <jhb@FreeBSD.org> | 2006-04-17 18:20:38 +0000 |
---|---|---|
committer | John Baldwin <jhb@FreeBSD.org> | 2006-04-17 18:20:38 +0000 |
commit | 0f180a7cce5bed801060557dd5bdbad64318d3c6 (patch) | |
tree | 6e1e68443c878ae084bc35e7e36a8edf68ad3352 /sys/vm/vm_zeroidle.c | |
parent | 00d02f943bbcd6ec85092821e9ee4d8adca83c83 (diff) | |
download | src-0f180a7cce5bed801060557dd5bdbad64318d3c6.tar.gz src-0f180a7cce5bed801060557dd5bdbad64318d3c6.zip |
Change msleep() and tsleep() to not alter the calling thread's priority
if the specified priority is zero. This avoids a race where the calling
thread could read a snapshot of it's current priority, then a different
thread could change the first thread's priority, then the original thread
would call sched_prio() inside msleep() undoing the change made by the
second thread. I used a priority of zero as no thread that calls msleep()
or tsleep() should be specifying a priority of zero anyway.
The various places that passed 'curthread->td_priority' or some variant
as the priority now pass 0.
Notes
Notes:
svn path=/head/; revision=157815
Diffstat (limited to 'sys/vm/vm_zeroidle.c')
-rw-r--r-- | sys/vm/vm_zeroidle.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/sys/vm/vm_zeroidle.c b/sys/vm/vm_zeroidle.c index 68babd0df138..683990f467e0 100644 --- a/sys/vm/vm_zeroidle.c +++ b/sys/vm/vm_zeroidle.c @@ -140,9 +140,7 @@ vm_page_zero_idle_wakeup(void) static void vm_pagezero(void __unused *arg) { - struct thread *td; - td = curthread; idlezero_enable = idlezero_enable_default; for (;;) { @@ -159,7 +157,7 @@ vm_pagezero(void __unused *arg) vm_page_lock_queues(); wakeup_needed = TRUE; msleep(&zero_state, &vm_page_queue_mtx, - PDROP | td->td_priority, "pgzero", hz * 300); + PDROP, "pgzero", hz * 300); } } } |