summaryrefslogtreecommitdiff
path: root/vm/vm_object.c
diff options
context:
space:
mode:
Diffstat (limited to 'vm/vm_object.c')
-rw-r--r--vm/vm_object.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/vm/vm_object.c b/vm/vm_object.c
index c650b8c..6622c99 100644
--- a/vm/vm_object.c
+++ b/vm/vm_object.c
@@ -189,6 +189,8 @@ struct lock vm_object_cache_lock_data;
lock_try_write(&vm_object_cache_lock_data)
#define vm_object_cache_unlock() \
lock_write_done(&vm_object_cache_lock_data)
+#define have_vm_object_cache_lock() \
+ have_write_lock(&vm_object_cache_lock_data)
/*
* Number of physical pages referenced by cached objects.
@@ -514,7 +516,6 @@ void vm_object_deallocate(
* Destroy the object; the cache lock will
* be released in the process.
*/
-
vm_object_terminate(object);
/*
@@ -546,6 +547,9 @@ void vm_object_terminate(
vm_page_t p;
vm_object_t shadow_object;
+ assert(have_vm_object_lock(object));
+ assert(have_vm_object_cache_lock());
+
/*
* Make sure the object isn't already being terminated
*/
@@ -737,6 +741,8 @@ void vm_object_abort_activity(
{
vm_page_t p, old_p;
+ assert(have_vm_object_lock(object));
+
/*
* Abort all activity that would be waiting
* for a result on this memory object.
@@ -780,6 +786,7 @@ void vm_object_abort_activity(
object->pager_ready = TRUE;
vm_object_wakeup(object, VM_OBJECT_EVENT_PAGER_READY);
+ assert(have_vm_object_lock(object));
}
/*
@@ -878,6 +885,8 @@ void vm_object_deactivate_pages(
{
vm_page_t p;
+ assert(have_vm_object_lock(object));
+
struct rdxtree_iter iter;
rdxtree_for_each(&object->memt, &iter, p) {
vm_page_lock_queues();
@@ -1336,6 +1345,8 @@ kern_return_t vm_object_copy_call(
vm_object_t new_object;
vm_page_t p;
+ assert(have_vm_object_lock(src_object));
+
/*
* Create a memory object port to be associated
* with this new vm_object.
@@ -2171,6 +2182,7 @@ restart:
/*
* [At this point, the object must be locked]
*/
+ assert(have_vm_object_lock(object));
/*
* Wait for the work above to be done by the first
@@ -2300,6 +2312,8 @@ void vm_object_remove(
{
ipc_port_t port;
+ assert(have_vm_object_cache_lock());
+
if ((port = object->pager) != IP_NULL) {
if (ip_kotype(port) == IKOT_PAGER)
ipc_kobject_set(port, IKO_NULL,
@@ -2355,6 +2369,8 @@ void vm_object_collapse(
vm_page_t p, pp;
ipc_port_t old_name_port;
+ assert(have_vm_object_lock(object));
+
if (!vm_object_collapse_allowed)
return;
@@ -2723,6 +2739,9 @@ void vm_object_page_remove(
vm_offset_t end)
{
vm_page_t p;
+
+ assert(have_vm_object_lock(object));
+
struct rdxtree_iter iter;
rdxtree_for_each(&object->memt, &iter, p) {
if ((start <= p->offset) && (p->offset < end)) {