summaryrefslogtreecommitdiffstats
path: root/sys/vm/vm_object.h
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2002-12-20 05:10:32 +0000
committeralc <alc@FreeBSD.org>2002-12-20 05:10:32 +0000
commit380a78911f64a84d65a18601fe8b9fdb8b1fc577 (patch)
tree2b8b1bb0942d8efbdaf89a4ca36c1ee03b32f134 /sys/vm/vm_object.h
parentafe2ea2b71e11bcbd8ca620fbcb80f69fc277f66 (diff)
downloadFreeBSD-src-380a78911f64a84d65a18601fe8b9fdb8b1fc577.zip
FreeBSD-src-380a78911f64a84d65a18601fe8b9fdb8b1fc577.tar.gz
Add a mutex to struct vm_object. Initialize and destroy that mutex
at appropriate times. For the moment, the mutex is only used on the kmem_object.
Diffstat (limited to 'sys/vm/vm_object.h')
-rw-r--r--sys/vm/vm_object.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/vm/vm_object.h b/sys/vm/vm_object.h
index 9f4e488..37a5472 100644
--- a/sys/vm/vm_object.h
+++ b/sys/vm/vm_object.h
@@ -72,6 +72,8 @@
#define _VM_OBJECT_
#include <sys/queue.h>
+#include <sys/_lock.h>
+#include <sys/_mutex.h>
enum obj_type { OBJT_DEFAULT, OBJT_SWAP, OBJT_VNODE, OBJT_DEVICE, OBJT_PHYS,
OBJT_DEAD };
@@ -88,6 +90,7 @@ typedef u_char objtype_t;
*/
struct vm_object {
+ struct mtx mtx;
TAILQ_ENTRY(vm_object) object_list; /* list of all objects */
TAILQ_HEAD(, vm_object) shadow_head; /* objects that this is a shadow for */
TAILQ_ENTRY(vm_object) shadow_list; /* chain of shadow objects */
@@ -171,8 +174,10 @@ extern vm_object_t kmem_object;
#endif /* _KERNEL */
#ifdef _KERNEL
-#define vm_object_lock(object) mtx_lock(&Giant)
-#define vm_object_unlock(object) mtx_unlock(&Giant)
+#define vm_object_lock(object) \
+ mtx_lock((object) == kmem_object ? &kmem_object->mtx : &Giant)
+#define vm_object_unlock(object) \
+ mtx_unlock((object) == kmem_object ? &kmem_object->mtx : &Giant)
void vm_freeze_copyopts(vm_object_t, vm_pindex_t, vm_pindex_t);
OpenPOWER on IntegriCloud