1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-15 10:17:20 +00:00

Use the free page queue mutex instead of the page queue mutex to

synchronize sleeping and waking of the zero idle thread.
This commit is contained in:
Alan Cox 2007-02-11 05:18:40 +00:00
parent 024465d002
commit 5351a2488a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=166637
2 changed files with 6 additions and 7 deletions

View File

@ -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);

View File

@ -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);
}
}
}