summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2007-02-11 05:18:40 +0000
committeralc <alc@FreeBSD.org>2007-02-11 05:18:40 +0000
commit909177e227a00404bc8c412d1a3cb60f2b4b4262 (patch)
tree94ca825e4779ea2d7b05d426f6eecb98e82ed141
parent6d93e146370ae32115c6cdf753c9f36a0c8068f4 (diff)
downloadFreeBSD-src-909177e227a00404bc8c412d1a3cb60f2b4b4262.zip
FreeBSD-src-909177e227a00404bc8c412d1a3cb60f2b4b4262.tar.gz
Use the free page queue mutex instead of the page queue mutex to
synchronize sleeping and waking of the zero idle thread.
-rw-r--r--sys/vm/vm_page.c2
-rw-r--r--sys/vm/vm_zeroidle.c11
2 files changed, 6 insertions, 7 deletions
diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c
index 4e96e2f..a73d76d 100644
--- a/sys/vm/vm_page.c
+++ b/sys/vm/vm_page.c
@@ -486,7 +486,6 @@ vm_page_free(vm_page_t m)
{
vm_page_flag_clear(m, PG_ZERO);
vm_page_free_toq(m);
- vm_page_zero_idle_wakeup();
}
/*
@@ -1164,6 +1163,7 @@ vm_page_free_toq(vm_page_t m)
++vm_page_zero_count;
} else {
TAILQ_INSERT_HEAD(&pq->pl, m, pageq);
+ vm_page_zero_idle_wakeup();
}
vm_page_free_wakeup();
mtx_unlock(&vm_page_queue_free_mtx);
diff --git a/sys/vm/vm_zeroidle.c b/sys/vm/vm_zeroidle.c
index 252f8d5..5af84e0 100644
--- a/sys/vm/vm_zeroidle.c
+++ b/sys/vm/vm_zeroidle.c
@@ -103,7 +103,7 @@ vm_page_zero_idle(void)
static int free_rover;
vm_page_t m;
- mtx_lock(&vm_page_queue_free_mtx);
+ mtx_assert(&vm_page_queue_free_mtx, MA_OWNED);
zero_state = 0;
m = vm_pageq_find(PQ_FREE, free_rover, FALSE);
if (m != NULL && (m->flags & PG_ZERO) == 0) {
@@ -119,7 +119,6 @@ vm_page_zero_idle(void)
zero_state = 1;
}
free_rover = (free_rover + PQ_PRIME2) & PQ_COLORMASK;
- mtx_unlock(&vm_page_queue_free_mtx);
}
/* Called by vm_page_free to hint that a new page is available. */
@@ -127,7 +126,7 @@ void
vm_page_zero_idle_wakeup(void)
{
- mtx_assert(&vm_page_queue_mtx, MA_OWNED);
+ mtx_assert(&vm_page_queue_free_mtx, MA_OWNED);
if (wakeup_needed && vm_page_zero_check()) {
wakeup_needed = FALSE;
wakeup(&zero_state);
@@ -140,6 +139,7 @@ vm_pagezero(void __unused *arg)
idlezero_enable = idlezero_enable_default;
+ mtx_lock(&vm_page_queue_free_mtx);
for (;;) {
if (vm_page_zero_check()) {
vm_page_zero_idle();
@@ -151,10 +151,9 @@ vm_pagezero(void __unused *arg)
}
#endif
} else {
- vm_page_lock_queues();
wakeup_needed = TRUE;
- msleep(&zero_state, &vm_page_queue_mtx,
- PDROP, "pgzero", hz * 300);
+ msleep(&zero_state, &vm_page_queue_free_mtx, 0,
+ "pgzero", hz * 300);
}
}
}
OpenPOWER on IntegriCloud