o Add a "needs wakeup" flag to the vm_map for use by kmem_alloc_wait()
and kmem_free_wakeup(). Previously, kmem_free_wakeup() always called wakeup(). In general, no one was sleeping. o Export vm_map_unlock_and_wait() and vm_map_wakeup() from vm_map.c for use in vm_kern.c.
This commit is contained in:
parent
aaa1c7715b
commit
9688f93163
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=99754
@ -473,10 +473,10 @@ kmem_alloc_wait(map, size)
|
||||
vm_map_unlock(map);
|
||||
return (0);
|
||||
}
|
||||
vm_map_unlock(map);
|
||||
tsleep(map, PVM, "kmaw", 0);
|
||||
map->needs_wakeup = TRUE;
|
||||
vm_map_unlock_and_wait(map, FALSE);
|
||||
}
|
||||
vm_map_insert(map, NULL, (vm_offset_t) 0, addr, addr + size, VM_PROT_ALL, VM_PROT_ALL, 0);
|
||||
vm_map_insert(map, NULL, 0, addr, addr + size, VM_PROT_ALL, VM_PROT_ALL, 0);
|
||||
vm_map_unlock(map);
|
||||
return (addr);
|
||||
}
|
||||
@ -497,7 +497,10 @@ kmem_free_wakeup(map, addr, size)
|
||||
|
||||
vm_map_lock(map);
|
||||
(void) vm_map_delete(map, trunc_page(addr), round_page(addr + size));
|
||||
wakeup(map);
|
||||
if (map->needs_wakeup) {
|
||||
map->needs_wakeup = FALSE;
|
||||
vm_map_wakeup(map);
|
||||
}
|
||||
vm_map_unlock(map);
|
||||
}
|
||||
|
||||
|
@ -418,7 +418,7 @@ _vm_map_lock_downgrade(vm_map_t map, const char *file, int line)
|
||||
/*
|
||||
* vm_map_unlock_and_wait:
|
||||
*/
|
||||
static __inline int
|
||||
int
|
||||
vm_map_unlock_and_wait(vm_map_t map, boolean_t user_wait)
|
||||
{
|
||||
int retval;
|
||||
@ -433,7 +433,7 @@ vm_map_unlock_and_wait(vm_map_t map, boolean_t user_wait)
|
||||
/*
|
||||
* vm_map_wakeup:
|
||||
*/
|
||||
static __inline void
|
||||
void
|
||||
vm_map_wakeup(vm_map_t map)
|
||||
{
|
||||
|
||||
@ -482,6 +482,7 @@ _vm_map_init(vm_map_t map, vm_offset_t min, vm_offset_t max)
|
||||
{
|
||||
|
||||
map->header.next = map->header.prev = &map->header;
|
||||
map->needs_wakeup = FALSE;
|
||||
map->system_map = 0;
|
||||
map->min_offset = min;
|
||||
map->max_offset = max;
|
||||
|
@ -164,6 +164,7 @@ struct vm_map {
|
||||
struct lock lock; /* Lock for map data */
|
||||
int nentries; /* Number of entries */
|
||||
vm_size_t size; /* virtual size */
|
||||
u_char needs_wakeup;
|
||||
u_char system_map; /* Am I a system map? */
|
||||
u_char infork; /* Am I in fork processing? */
|
||||
vm_map_entry_t root;
|
||||
@ -245,6 +246,8 @@ void _vm_map_unlock_read(vm_map_t map, const char *file, int line);
|
||||
int _vm_map_trylock(vm_map_t map, const char *file, int line);
|
||||
int _vm_map_lock_upgrade(vm_map_t map, const char *file, int line);
|
||||
void _vm_map_lock_downgrade(vm_map_t map, const char *file, int line);
|
||||
int vm_map_unlock_and_wait(vm_map_t map, boolean_t user_wait);
|
||||
void vm_map_wakeup(vm_map_t map);
|
||||
|
||||
#define vm_map_lock(map) _vm_map_lock(map, LOCK_FILE, LOCK_LINE)
|
||||
#define vm_map_unlock(map) _vm_map_unlock(map, LOCK_FILE, LOCK_LINE)
|
||||
|
Loading…
Reference in New Issue
Block a user