kernel - Export vm_map_transition_wait and correct race between sleep/wakeup.
authorVenkatesh Srinivas <me@endeavour.zapto.org>
Wed, 24 Nov 2010 20:40:40 +0000 (12:40 -0800)
committerVenkatesh Srinivas <me@endeavour.zapto.org>
Wed, 24 Nov 2010 20:40:40 +0000 (12:40 -0800)
sys/vm/vm_map.c
sys/vm/vm_map.h

index c01e96d..4d8add2 100644 (file)
@@ -75,6 +75,7 @@
 #include <sys/systm.h>
 #include <sys/kernel.h>
 #include <sys/proc.h>
+#include <sys/serialize.h>
 #include <sys/lock.h>
 #include <sys/vmmeter.h>
 #include <sys/mman.h>
@@ -1418,12 +1419,12 @@ _vm_map_clip_end(vm_map_t map, vm_map_entry_t entry, vm_offset_t end,
  * Used to block when an in-transition collison occurs.  The map
  * is unlocked for the sleep and relocked before the return.
  */
-static
 void
 vm_map_transition_wait(vm_map_t map)
 {
+       tsleep_interlock(map, 0);
        vm_map_unlock(map);
-       tsleep(map, 0, "vment", 0);
+       tsleep(map, PINTERLOCKED, "vment", 0);
        vm_map_lock(map);
 }
 
index 93c6a39..0fbcfe1 100644 (file)
@@ -529,6 +529,8 @@ int vm_map_growstack (struct proc *p, vm_offset_t addr);
 int vmspace_swap_count (struct vmspace *vmspace);
 int vmspace_anonymous_count (struct vmspace *vmspace);
 void vm_map_set_wired_quick(vm_map_t map, vm_offset_t addr, vm_size_t size, int *);
+void vm_map_transition_wait(vm_map_t map);
+
 
 #endif
 #endif                         /* _VM_VM_MAP_H_ */