From ff13bc52ac8248043eabcaa4feac43afaf8e3f90 Mon Sep 17 00:00:00 2001 From: Venkatesh Srinivas Date: Wed, 24 Nov 2010 12:40:40 -0800 Subject: [PATCH] kernel - Export vm_map_transition_wait and correct race between sleep/wakeup. --- sys/vm/vm_map.c | 5 +++-- sys/vm/vm_map.h | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c index c01e96d42a..4d8add2585 100644 --- a/sys/vm/vm_map.c +++ b/sys/vm/vm_map.c @@ -75,6 +75,7 @@ #include #include #include +#include #include #include #include @@ -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); } diff --git a/sys/vm/vm_map.h b/sys/vm/vm_map.h index 93c6a392b8..0fbcfe1705 100644 --- a/sys/vm/vm_map.h +++ b/sys/vm/vm_map.h @@ -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_ */ -- 2.11.4.GIT