aboutsummaryrefslogtreecommitdiff
path: root/sys/vm/default_pager.c
diff options
context:
space:
mode:
authorAttilio Rao <attilio@FreeBSD.org>2013-03-09 02:32:23 +0000
committerAttilio Rao <attilio@FreeBSD.org>2013-03-09 02:32:23 +0000
commit89f6b8632cc94bca2738b4fcc26e1189ef4f5dde (patch)
tree382de98b1c7b142a92ed9c04ab1ea90d5a1c3a06 /sys/vm/default_pager.c
parentc934116100c5a3574cb1bde0dc0b80b6b41d7e54 (diff)
downloadsrc-89f6b8632cc94bca2738b4fcc26e1189ef4f5dde.tar.gz
src-89f6b8632cc94bca2738b4fcc26e1189ef4f5dde.zip
Switch the vm_object mutex to be a rwlock. This will enable in the
future further optimizations where the vm_object lock will be held in read mode most of the time the page cache resident pool of pages are accessed for reading purposes. The change is mostly mechanical but few notes are reported: * The KPI changes as follow: - VM_OBJECT_LOCK() -> VM_OBJECT_WLOCK() - VM_OBJECT_TRYLOCK() -> VM_OBJECT_TRYWLOCK() - VM_OBJECT_UNLOCK() -> VM_OBJECT_WUNLOCK() - VM_OBJECT_LOCK_ASSERT(MA_OWNED) -> VM_OBJECT_ASSERT_WLOCKED() (in order to avoid visibility of implementation details) - The read-mode operations are added: VM_OBJECT_RLOCK(), VM_OBJECT_TRYRLOCK(), VM_OBJECT_RUNLOCK(), VM_OBJECT_ASSERT_RLOCKED(), VM_OBJECT_ASSERT_LOCKED() * The vm/vm_pager.h namespace pollution avoidance (forcing requiring sys/mutex.h in consumers directly to cater its inlining functions using VM_OBJECT_LOCK()) imposes that all the vm/vm_pager.h consumers now must include also sys/rwlock.h. * zfs requires a quite convoluted fix to include FreeBSD rwlocks into the compat layer because the name clash between FreeBSD and solaris versions must be avoided. At this purpose zfs redefines the vm_object locking functions directly, isolating the FreeBSD components in specific compat stubs. The KPI results heavilly broken by this commit. Thirdy part ports must be updated accordingly (I can think off-hand of VirtualBox, for example). Sponsored by: EMC / Isilon storage division Reviewed by: jeff Reviewed by: pjd (ZFS specific review) Discussed with: alc Tested by: pho
Notes
Notes: svn path=/head/; revision=248084
Diffstat (limited to 'sys/vm/default_pager.c')
-rw-r--r--sys/vm/default_pager.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/vm/default_pager.c b/sys/vm/default_pager.c
index 12dc82345b03..a71a22a191ae 100644
--- a/sys/vm/default_pager.c
+++ b/sys/vm/default_pager.c
@@ -45,7 +45,7 @@ __FBSDID("$FreeBSD$");
#include <sys/lock.h>
#include <sys/proc.h>
#include <sys/resourcevar.h>
-#include <sys/mutex.h>
+#include <sys/rwlock.h>
#include <vm/vm.h>
#include <vm/vm_object.h>
@@ -91,10 +91,10 @@ default_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot,
object = vm_object_allocate(OBJT_DEFAULT,
OFF_TO_IDX(round_page(offset + size)));
if (cred != NULL) {
- VM_OBJECT_LOCK(object);
+ VM_OBJECT_WLOCK(object);
object->cred = cred;
object->charge = size;
- VM_OBJECT_UNLOCK(object);
+ VM_OBJECT_WUNLOCK(object);
}
return (object);
}