summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorNiklas Hallqvist <niklas@cvs.openbsd.org>1996-12-24 20:14:33 +0000
committerNiklas Hallqvist <niklas@cvs.openbsd.org>1996-12-24 20:14:33 +0000
commite15f116b6f6f3b39a5dbf4b24643a7d58c41e0a2 (patch)
tree091be2f032e005e903b9cb670a5e36505694a210 /sys
parent4b846f2f7254c6f5049614ed7c7855c814e04185 (diff)
Make termination of objects wait for possible collapses before altering
the object's shadow linkage. Also note that the object is going to die so that a possible collapse can finish early.
Diffstat (limited to 'sys')
-rw-r--r--sys/vm/vm_object.c37
-rw-r--r--sys/vm/vm_object.h3
2 files changed, 30 insertions, 10 deletions
diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c
index 0fa0d2e92c4..722d2f583b0 100644
--- a/sys/vm/vm_object.c
+++ b/sys/vm/vm_object.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vm_object.c,v 1.12 1996/11/06 23:24:40 niklas Exp $ */
+/* $OpenBSD: vm_object.c,v 1.13 1996/12/24 20:14:28 niklas Exp $ */
/* $NetBSD: vm_object.c,v 1.34 1996/02/28 22:35:35 gwr Exp $ */
/*
@@ -338,6 +338,21 @@ vm_object_terminate(object)
vm_object_t shadow_object;
/*
+ * Setters of paging_in_progress might be interested that this object
+ * is going away as soon as we get a grip on it.
+ */
+ object->flags |= OBJ_FADING;
+
+ /*
+ * Wait until the pageout daemon is through with the object or a
+ * potential collapse operation is finished.
+ */
+ while (object->paging_in_progress) {
+ vm_object_sleep(object, object, FALSE);
+ vm_object_lock(object);
+ }
+
+ /*
* Detach the object from its shadow if we are the shadow's
* copy.
*/
@@ -354,14 +369,6 @@ vm_object_terminate(object)
}
/*
- * Wait until the pageout daemon is through with the object.
- */
- while (object->paging_in_progress) {
- vm_object_sleep(object, object, FALSE);
- vm_object_lock(object);
- }
-
- /*
* If not an internal object clean all the pages, removing them
* from paging queues as we go.
*
@@ -1341,6 +1348,18 @@ vm_object_collapse_aux(object)
thread_wakeup(object);
/*
+ * During the pagein vm_object_terminate
+ * might have slept on our front object in
+ * order to remove it. If this is the
+ * case, we might as well stop all the
+ * collapse work right here.
+ */
+ if (object->flags & OBJ_FADING) {
+ PAGE_WAKEUP(backing_page);
+ return KERN_FAILURE;
+ }
+
+ /*
* Third, relookup in case pager changed
* page. Pager is responsible for
* disposition of old page if moved.
diff --git a/sys/vm/vm_object.h b/sys/vm/vm_object.h
index 46a7939ac68..be739e1fb11 100644
--- a/sys/vm/vm_object.h
+++ b/sys/vm/vm_object.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: vm_object.h,v 1.3 1996/08/02 00:06:02 niklas Exp $ */
+/* $OpenBSD: vm_object.h,v 1.4 1996/12/24 20:14:32 niklas Exp $ */
/* $NetBSD: vm_object.h,v 1.16 1995/03/29 22:10:28 briggs Exp $ */
/*
@@ -110,6 +110,7 @@ struct vm_object {
#define OBJ_CANPERSIST 0x0001 /* allow to persist */
#define OBJ_INTERNAL 0x0002 /* internally created object */
#define OBJ_ACTIVE 0x0004 /* used to mark active objects */
+#define OBJ_FADING 0x0008 /* tell others that the object is going away */
TAILQ_HEAD(vm_object_hash_head, vm_object_hash_entry);