diff options
author | alc <alc@FreeBSD.org> | 2004-10-31 19:32:57 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2004-10-31 19:32:57 +0000 |
commit | d9ced80d66fb0e025608df1ddcb2b0746a28f177 (patch) | |
tree | b1f37783c726c6bafbea69567df52ca3b9f1edcc | |
parent | 08501005ec8ab1e5d44c27c83e0ba0166796e495 (diff) | |
download | FreeBSD-src-d9ced80d66fb0e025608df1ddcb2b0746a28f177.zip FreeBSD-src-d9ced80d66fb0e025608df1ddcb2b0746a28f177.tar.gz |
Introduce a Boolean variable wakeup_needed to avoid repeated, unnecessary
calls to wakeup() by vm_page_zero_idle_wakeup().
-rw-r--r-- | sys/vm/vm_zeroidle.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/vm/vm_zeroidle.c b/sys/vm/vm_zeroidle.c index 0e8ac78..9abd5f1 100644 --- a/sys/vm/vm_zeroidle.c +++ b/sys/vm/vm_zeroidle.c @@ -76,6 +76,7 @@ TUNABLE_INT("vm.idlezero_maxrun", &idlezero_maxrun); #define ZIDLE_LO(v) ((v) * 2 / 3) #define ZIDLE_HI(v) ((v) * 4 / 5) +static boolean_t wakeup_needed = FALSE; static int zero_state; static int @@ -130,8 +131,11 @@ void vm_page_zero_idle_wakeup(void) { - if (idlezero_enable && vm_page_zero_check()) + mtx_assert(&vm_page_queue_mtx, MA_OWNED); + if (wakeup_needed && vm_page_zero_check()) { + wakeup_needed = FALSE; wakeup(&zero_state); + } } static void @@ -163,7 +167,10 @@ vm_pagezero(void __unused *arg) } #endif } else { - tsleep(&zero_state, pri, "pgzero", hz * 300); + vm_page_lock_queues(); + wakeup_needed = TRUE; + msleep(&zero_state, &vm_page_queue_mtx, PDROP | pri, + "pgzero", hz * 300); pages = 0; } } |