From 24c9ad6beda506c7e28b00402fd2eaaea8f5b26b Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Thu, 19 Dec 2002 07:23:46 +0000 Subject: [PATCH] - Remove vm_page_sleep_busy(). The transition to vm_page_sleep_if_busy(), which incorporates page queue and field locking, is complete. - Assert that the page queue lock rather than Giant is held in vm_page_flag_set(). --- sys/vm/vm_page.c | 36 ++---------------------------------- sys/vm/vm_page.h | 1 - 2 files changed, 2 insertions(+), 35 deletions(-) diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index ee23febe4c8..4a0454f155e 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -277,7 +277,8 @@ vm_page_startup(vm_offset_t starta, vm_offset_t enda, vm_offset_t vaddr) void vm_page_flag_set(vm_page_t m, unsigned short bits) { - GIANT_REQUIRED; + + mtx_assert(&vm_page_queue_mtx, MA_OWNED); m->flags |= bits; } @@ -413,39 +414,6 @@ vm_page_free_zero(vm_page_t m) vm_page_free_toq(m); } -/* - * vm_page_sleep_busy: - * - * Wait until page is no longer PG_BUSY or (if also_m_busy is TRUE) - * m->busy is zero. Returns TRUE if it had to sleep ( including if - * it almost had to sleep and made temporary spl*() mods), FALSE - * otherwise. - * - * This routine assumes that interrupts can only remove the busy - * status from a page, not set the busy status or change it from - * PG_BUSY to m->busy or vise versa (which would create a timing - * window). - */ -int -vm_page_sleep_busy(vm_page_t m, int also_m_busy, const char *msg) -{ - GIANT_REQUIRED; - if ((m->flags & PG_BUSY) || (also_m_busy && m->busy)) { - int s = splvm(); - if ((m->flags & PG_BUSY) || (also_m_busy && m->busy)) { - /* - * Page is busy. Wait and retry. - */ - vm_page_flag_set(m, PG_WANTED | PG_REFERENCED); - tsleep(m, PVM, msg, 0); - } - splx(s); - return (TRUE); - /* not reached */ - } - return (FALSE); -} - /* * vm_page_sleep_if_busy: * diff --git a/sys/vm/vm_page.h b/sys/vm/vm_page.h index 72cf4ebc651..67e35298344 100644 --- a/sys/vm/vm_page.h +++ b/sys/vm/vm_page.h @@ -330,7 +330,6 @@ void vm_page_unhold(vm_page_t mem); void vm_page_copy(vm_page_t src_m, vm_page_t dest_m); void vm_page_free(vm_page_t m); void vm_page_free_zero(vm_page_t m); -int vm_page_sleep_busy(vm_page_t m, int also_m_busy, const char *msg); int vm_page_sleep_if_busy(vm_page_t m, int also_m_busy, const char *msg); void vm_page_dirty(vm_page_t m); void vm_page_wakeup(vm_page_t m);