aboutsummaryrefslogtreecommitdiff
path: root/sys/vm
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2016-02-28 17:52:33 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2016-02-28 17:52:33 +0000
commit1bdbd705993eab79189dff87b69a9cff5c69b17e (patch)
tree93354adb0a612a635964c8498072087760a0f93b /sys/vm
parent3f3af790f95027d0c3b859a53eb82ef5d00dc4f8 (diff)
Implement process-shared locks support for libthr.so.3, without
breaking the ABI. Special value is stored in the lock pointer to indicate shared lock, and offline page in the shared memory is allocated to store the actual lock. Reviewed by: vangyzen (previous version) Discussed with: deischen, emaste, jhb, rwatson, Martin Simmons <martin@lispworks.com> Tested by: pho Sponsored by: The FreeBSD Foundation
Notes
svn path=/head/; revision=296162
Diffstat (limited to 'sys/vm')
-rw-r--r--sys/vm/vm_object.c5
-rw-r--r--sys/vm/vm_object.h5
2 files changed, 10 insertions, 0 deletions
diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c
index bc0e4c05f126..1b1d532ba1cf 100644
--- a/sys/vm/vm_object.c
+++ b/sys/vm/vm_object.c
@@ -264,6 +264,7 @@ _vm_object_allocate(objtype_t type, vm_pindex_t size, vm_object_t object)
#if VM_NRESERVLEVEL > 0
LIST_INIT(&object->rvq);
#endif
+ umtx_shm_object_init(object);
}
/*
@@ -475,6 +476,9 @@ vm_object_vndeallocate(vm_object_t object)
}
#endif
+ if (object->ref_count == 1)
+ umtx_shm_object_terminated(object);
+
/*
* The test for text of vp vnode does not need a bypass to
* reach right VV_TEXT there, since it is obtained from
@@ -647,6 +651,7 @@ retry:
return;
}
doterm:
+ umtx_shm_object_terminated(object);
temp = object->backing_object;
if (temp != NULL) {
KASSERT((object->flags & OBJ_TMPFS_NODE) == 0,
diff --git a/sys/vm/vm_object.h b/sys/vm/vm_object.h
index ca2d73a75a42..c68fdce09158 100644
--- a/sys/vm/vm_object.h
+++ b/sys/vm/vm_object.h
@@ -174,6 +174,7 @@ struct vm_object {
} un_pager;
struct ucred *cred;
vm_ooffset_t charge;
+ void *umtx_data;
};
/*
@@ -184,6 +185,7 @@ struct vm_object {
#define OBJ_ACTIVE 0x0004 /* active objects */
#define OBJ_DEAD 0x0008 /* dead objects (during rundown) */
#define OBJ_NOSPLIT 0x0010 /* dont split this object */
+#define OBJ_UMTXDEAD 0x0020 /* umtx pshared was terminated */
#define OBJ_PIPWNT 0x0040 /* paging in progress wanted */
#define OBJ_MIGHTBEDIRTY 0x0100 /* object might be dirty, only for vnode */
#define OBJ_TMPFS_NODE 0x0200 /* object belongs to tmpfs VREG node */
@@ -296,6 +298,9 @@ vm_object_cache_is_empty(vm_object_t object)
return (vm_radix_is_empty(&object->cache));
}
+void umtx_shm_object_init(vm_object_t object);
+void umtx_shm_object_terminated(vm_object_t object);
+
vm_object_t vm_object_allocate (objtype_t, vm_pindex_t);
boolean_t vm_object_coalesce(vm_object_t, vm_ooffset_t, vm_size_t, vm_size_t,
boolean_t);