diff options
author | Richard Braun <rbraun@sceen.net> | 2013-04-17 22:25:22 +0200 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2013-04-17 22:25:22 +0200 |
commit | 7fbccc553e8d43a19e68d24aaad41978d58b9696 (patch) | |
tree | 88d9268fd4004085aae64797a7caf99cfafaac6a | |
parent | 0f604cb83c7f3b08cc922addfc4ce819fdb69a49 (diff) |
vm/vm_map: replace spin locks with mutexes
-rw-r--r-- | vm/vm_map.c | 16 | ||||
-rw-r--r-- | vm/vm_map.h | 6 |
2 files changed, 11 insertions, 11 deletions
diff --git a/vm/vm_map.c b/vm/vm_map.c index eaf09ec1..f533a627 100644 --- a/vm/vm_map.c +++ b/vm/vm_map.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012 Richard Braun. + * Copyright (c) 2011, 2012, 2013 Richard Braun. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -36,11 +36,11 @@ #include <kern/kmem.h> #include <kern/list.h> #include <kern/macros.h> +#include <kern/mutex.h> #include <kern/panic.h> #include <kern/param.h> #include <kern/printk.h> #include <kern/rbtree.h> -#include <kern/spinlock.h> #include <kern/stddef.h> #include <kern/stdint.h> #include <machine/pmap.h> @@ -781,7 +781,7 @@ vm_map_enter(struct vm_map *map, struct vm_object *object, uint64_t offset, struct vm_map_request request; int error; - spinlock_lock(&map->lock); + mutex_lock(&map->lock); error = vm_map_prepare(map, object, offset, *startp, size, align, flags, &request); @@ -794,14 +794,14 @@ vm_map_enter(struct vm_map *map, struct vm_object *object, uint64_t offset, if (error) goto error_enter; - spinlock_unlock(&map->lock); + mutex_unlock(&map->lock); *startp = request.start; return 0; error_enter: vm_map_reset_find_cache(map); - spinlock_unlock(&map->lock); + mutex_unlock(&map->lock); return error; } @@ -862,7 +862,7 @@ vm_map_remove(struct vm_map *map, unsigned long start, unsigned long end) assert(end <= map->end); assert(start < end); - spinlock_lock(&map->lock); + mutex_lock(&map->lock); entry = vm_map_lookup_nearest(map, start); @@ -884,7 +884,7 @@ vm_map_remove(struct vm_map *map, unsigned long start, unsigned long end) vm_map_reset_find_cache(map); out: - spinlock_unlock(&map->lock); + mutex_unlock(&map->lock); } static void @@ -894,7 +894,7 @@ vm_map_init(struct vm_map *map, struct pmap *pmap, unsigned long start, assert(vm_page_aligned(start)); assert(vm_page_aligned(end)); - spinlock_init(&map->lock); + mutex_init(&map->lock); list_init(&map->entry_list); rbtree_init(&map->entry_tree); map->nr_entries = 0; diff --git a/vm/vm_map.h b/vm/vm_map.h index 5b4edbcf..d4a8eb02 100644 --- a/vm/vm_map.h +++ b/vm/vm_map.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012 Richard Braun. + * Copyright (c) 2011, 2012, 2013 Richard Braun. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,8 +22,8 @@ #define _VM_VM_MAP_H #include <kern/list.h> +#include <kern/mutex.h> #include <kern/rbtree.h> -#include <kern/spinlock.h> #include <kern/stdint.h> #include <machine/pmap.h> @@ -92,7 +92,7 @@ struct vm_map_entry { * Memory map. */ struct vm_map { - struct spinlock lock; + struct mutex lock; struct list entry_list; struct rbtree entry_tree; unsigned int nr_entries; |