Permalink
Browse files

fix from niklas. removes all known problems. log message from

openbsd reads:

>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.
  • Loading branch information...
1 parent 1173db8 commit c28afd14827003bb48d98f66426b262698be53c0 mrg committed Dec 26, 1996
Showing with 30 additions and 10 deletions.
  1. +28 −9 sys/vm/vm_object.c
  2. +2 −1 sys/vm/vm_object.h
View
@@ -1,4 +1,4 @@
-/* $NetBSD: vm_object.c,v 1.36.2.2 1996/12/07 13:52:24 mrg Exp $ */
+/* $NetBSD: vm_object.c,v 1.36.2.3 1996/12/26 16:41:47 mrg Exp $ */
/*
* Copyright (c) 1991, 1993
@@ -337,6 +337,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.
*/
@@ -353,14 +368,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.
*
@@ -1339,6 +1346,18 @@ vm_object_collapse_aux(object)
thread_wakeup(backing_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
View
@@ -1,4 +1,4 @@
-/* $NetBSD: vm_object.h,v 1.16.4.1 1996/12/07 12:10:05 mrg Exp $ */
+/* $NetBSD: vm_object.h,v 1.16.4.2 1996/12/26 16:41:48 mrg Exp $ */
/*
* Copyright (c) 1991, 1993
@@ -109,6 +109,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);

0 comments on commit c28afd1

Please sign in to comment.