summaryrefslogtreecommitdiffstats
path: root/sys/vm/vm_page.c
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2004-11-03 20:17:31 +0000
committeralc <alc@FreeBSD.org>2004-11-03 20:17:31 +0000
commit25b80a64b9fc30297401a041a69a8229872b01c4 (patch)
tree424cbe6b795ce744b46e7a81db98175896cc5a16 /sys/vm/vm_page.c
parentd083dba3a2fbaeb254502ed1ca0893eb4a5aae14 (diff)
downloadFreeBSD-src-25b80a64b9fc30297401a041a69a8229872b01c4.zip
FreeBSD-src-25b80a64b9fc30297401a041a69a8229872b01c4.tar.gz
The synchronization provided by vm object locking has eliminated the
need for most calls to vm_page_busy(). Specifically, most calls to vm_page_busy() occur immediately prior to a call to vm_page_remove(). In such cases, the containing vm object is locked across both calls. Consequently, the setting of the vm page's PG_BUSY flag is not even visible to other threads that are following the synchronization protocol. This change (1) eliminates the calls to vm_page_busy() that immediately precede a call to vm_page_remove() or functions, such as vm_page_free() and vm_page_rename(), that call it and (2) relaxes the requirement in vm_page_remove() that the vm page's PG_BUSY flag is set. Now, the vm page's PG_BUSY flag is set only when the vm object lock is released while the vm page is still in transition. Typically, this is when it is undergoing I/O.
Diffstat (limited to 'sys/vm/vm_page.c')
-rw-r--r--sys/vm/vm_page.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c
index 5001c78..3b880c9 100644
--- a/sys/vm/vm_page.c
+++ b/sys/vm/vm_page.c
@@ -609,21 +609,15 @@ vm_page_remove(vm_page_t m)
vm_page_t root;
mtx_assert(&vm_page_queue_mtx, MA_OWNED);
- if (m->object == NULL)
+ if ((object = m->object) == NULL)
return;
- VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED);
- if ((m->flags & PG_BUSY) == 0) {
- panic("vm_page_remove: page not busy");
+ VM_OBJECT_LOCK_ASSERT(object, MA_OWNED);
+ if (m->flags & PG_BUSY) {
+ vm_page_flag_clear(m, PG_BUSY);
+ vm_page_flash(m);
}
/*
- * Basically destroy the page.
- */
- vm_page_wakeup(m);
-
- object = m->object;
-
- /*
* Now remove from the object's list of backed pages.
*/
if (m != object->root)
@@ -810,7 +804,6 @@ loop:
}
m_object = m->object;
VM_OBJECT_LOCK_ASSERT(m_object, MA_OWNED);
- vm_page_busy(m);
vm_page_free(m);
vm_page_unlock_queues();
if (m_object != object)
@@ -1298,7 +1291,6 @@ vm_page_try_to_free(vm_page_t m)
pmap_remove_all(m);
if (m->dirty)
return (0);
- vm_page_busy(m);
vm_page_free(m);
return (1);
}
@@ -1667,7 +1659,6 @@ vm_page_cowfault(vm_page_t m)
pindex = m->pindex;
retry_alloc:
- vm_page_busy(m);
vm_page_remove(m);
mnew = vm_page_alloc(object, pindex, VM_ALLOC_NORMAL);
if (mnew == NULL) {
OpenPOWER on IntegriCloud