summaryrefslogtreecommitdiff
path: root/sys/vm/vm_object.h
diff options
context:
space:
mode:
Diffstat (limited to 'sys/vm/vm_object.h')
-rw-r--r--sys/vm/vm_object.h52
1 files changed, 49 insertions, 3 deletions
diff --git a/sys/vm/vm_object.h b/sys/vm/vm_object.h
index be739e1fb11..370bab3920b 100644
--- a/sys/vm/vm_object.h
+++ b/sys/vm/vm_object.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: vm_object.h,v 1.4 1996/12/24 20:14:32 niklas Exp $ */
+/* $OpenBSD: vm_object.h,v 1.5 1997/04/17 01:25:21 niklas Exp $ */
/* $NetBSD: vm_object.h,v 1.16 1995/03/29 22:10:28 briggs Exp $ */
/*
@@ -111,6 +111,7 @@ struct vm_object {
#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 */
+#define OBJ_WAITING 0x8000 /* someone is waiting for paging to finish */
TAILQ_HEAD(vm_object_hash_head, vm_object_hash_entry);
@@ -144,8 +145,53 @@ vm_object_t kmem_object;
#define vm_object_lock(object) simple_lock(&(object)->Lock)
#define vm_object_unlock(object) simple_unlock(&(object)->Lock)
#define vm_object_lock_try(object) simple_lock_try(&(object)->Lock)
-#define vm_object_sleep(event, object, interruptible) \
- thread_sleep((event), &(object)->Lock, (interruptible))
+
+#define vm_object_sleep(event, object, interruptible, where) \
+ do { \
+ (object)->flags |= OBJ_WAITING; \
+ thread_sleep_msg((event), &(object)->Lock, \
+ (interruptible), (where)); \
+ } while (0)
+
+#define vm_object_wakeup(object) \
+ do { \
+ if ((object)->flags & OBJ_WAITING) { \
+ (object)->flags &= ~OBJ_WAITING; \
+ thread_wakeup((object)); \
+ } \
+ } while (0)
+
+#define vm_object_paging(object) \
+ ((object)->paging_in_progress != 0)
+
+#ifndef DIAGNOSTIC
+#define vm_object_paging_begin(object) \
+ do { \
+ (object)->paging_in_progress++; \
+ } while (0)
+#else
+#define vm_object_paging_begin(object) \
+ do { \
+ if ((object)->paging_in_progress == 0xdead) \
+ panic("vm_object_paging_begin"); \
+ (object)->paging_in_progress++; \
+ } while (0)
+#endif
+
+#define vm_object_paging_end(object) \
+ do { \
+ if (--((object)->paging_in_progress) == 0) \
+ vm_object_wakeup((object)); \
+ } while (0)
+
+#define vm_object_paging_wait(object) \
+ do { \
+ while (vm_object_paging((object))) { \
+ vm_object_sleep((object), (object), FALSE, \
+ "vospgw"); \
+ vm_object_lock((object)); \
+ } \
+ } while (0)
#ifdef _KERNEL
vm_object_t vm_object_allocate __P((vm_size_t));