diff options
author | alc <alc@FreeBSD.org> | 2010-05-05 18:16:06 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2010-05-05 18:16:06 +0000 |
commit | 5c7ca3ee73eb98150c91a44001daf8ac7adb0907 (patch) | |
tree | aed312c92f14a164a2e36963e81da2e8973206a2 /sys/vm | |
parent | 402e3baadee30786a2a2fa508b9b7bec572da072 (diff) | |
download | FreeBSD-src-5c7ca3ee73eb98150c91a44001daf8ac7adb0907.zip FreeBSD-src-5c7ca3ee73eb98150c91a44001daf8ac7adb0907.tar.gz |
Acquire the page lock around all remaining calls to vm_page_free() on
managed pages that didn't already have that lock held. (Freeing an
unmanaged page, such as the various pmaps use, doesn't require the page
lock.)
This allows a change in vm_page_remove()'s locking requirements. It now
expects the page lock to be held instead of the page queues lock.
Consequently, the page queues lock is no longer required at all by callers
to vm_page_rename().
Discussed with: kib
Diffstat (limited to 'sys/vm')
-rw-r--r-- | sys/vm/vm_fault.c | 2 | ||||
-rw-r--r-- | sys/vm/vm_object.c | 4 | ||||
-rw-r--r-- | sys/vm/vm_page.c | 12 | ||||
-rw-r--r-- | sys/vm/vm_page.h | 2 |
4 files changed, 9 insertions, 11 deletions
diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c index 373433f..2978f7f 100644 --- a/sys/vm/vm_fault.c +++ b/sys/vm/vm_fault.c @@ -778,9 +778,7 @@ vnode_locked: * automatically made dirty. */ vm_page_lock(fs.m); - vm_page_lock_queues(); vm_page_rename(fs.m, fs.first_object, fs.first_pindex); - vm_page_unlock_queues(); vm_page_unlock(fs.m); vm_page_busy(fs.m); fs.first_m = fs.m; diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index b5f246c..f8c50bc 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -1461,9 +1461,7 @@ retry: goto retry; } vm_page_lock(m); - vm_page_lock_queues(); vm_page_rename(m, new_object, idx); - vm_page_unlock_queues(); vm_page_unlock(m); /* page automatically made dirty by rename and cache handled */ vm_page_busy(m); @@ -1691,9 +1689,7 @@ vm_object_backing_scan(vm_object_t object, int op) * mapped through the rename. */ vm_page_lock(p); - vm_page_lock_queues(); vm_page_rename(p, object, new_pindex); - vm_page_unlock_queues(); vm_page_unlock(p); /* page automatically made dirty by rename */ } diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index a77dc13..cc34c1b 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -791,7 +791,7 @@ vm_page_remove(vm_page_t m) vm_page_t root; if ((m->flags & PG_UNMANAGED) == 0) - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + vm_page_lock_assert(m, MA_OWNED); if ((object = m->object) == NULL) return; VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); @@ -2234,11 +2234,11 @@ vm_page_cowfault(vm_page_t m) retry_alloc: pmap_remove_all(m); + vm_page_unlock_queues(); vm_page_remove(m); mnew = vm_page_alloc(object, pindex, VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY); if (mnew == NULL) { vm_page_insert(m, object, pindex); - vm_page_unlock_queues(); vm_page_unlock(m); VM_OBJECT_UNLOCK(object); VM_WAIT; @@ -2261,7 +2261,12 @@ vm_page_cowfault(vm_page_t m) * waiting to allocate a page. If so, put things back * the way they were */ + vm_page_unlock(m); + vm_page_lock(mnew); + vm_page_lock_queues(); vm_page_free(mnew); + vm_page_unlock_queues(); + vm_page_unlock(mnew); vm_page_insert(m, object, pindex); } else { /* clear COW & copy page */ if (!so_zerocp_fullpage) @@ -2270,9 +2275,8 @@ vm_page_cowfault(vm_page_t m) vm_page_dirty(mnew); mnew->wire_count = m->wire_count - m->cow; m->wire_count = m->cow; + vm_page_unlock(m); } - vm_page_unlock_queues(); - vm_page_unlock(m); } void diff --git a/sys/vm/vm_page.h b/sys/vm/vm_page.h index 51a896f..da4d42a 100644 --- a/sys/vm/vm_page.h +++ b/sys/vm/vm_page.h @@ -103,7 +103,7 @@ struct vm_page { struct vm_page *left; /* splay tree link (O) */ struct vm_page *right; /* splay tree link (O) */ - vm_object_t object; /* which object am I in (O,Q)*/ + vm_object_t object; /* which object am I in (O,P)*/ vm_pindex_t pindex; /* offset into object (O,Q) */ vm_paddr_t phys_addr; /* physical address of page */ struct md_page md; /* machine dependant stuff */ |