diff options
author | alc <alc@FreeBSD.org> | 2002-06-19 06:02:03 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2002-06-19 06:02:03 +0000 |
commit | 6c0c1a3de38306f5105ac83bd1939798585a738c (patch) | |
tree | 97321f305f287e32e95b6702f8dc833cd0e1c136 | |
parent | 690ea8569d9ac749fee3c42bb6ac1c4c946a30b5 (diff) | |
download | FreeBSD-src-6c0c1a3de38306f5105ac83bd1939798585a738c.zip FreeBSD-src-6c0c1a3de38306f5105ac83bd1939798585a738c.tar.gz |
o Replace GIANT_REQUIRED in vm_object_coalesce() by the acquisition and
release of Giant.
o Reduce the scope of GIANT_REQUIRED in vm_map_insert().
These changes will enable us to remove the acquisition and release
of Giant from obreak().
-rw-r--r-- | sys/vm/vm_map.c | 4 | ||||
-rw-r--r-- | sys/vm/vm_object.c | 14 |
2 files changed, 10 insertions, 8 deletions
diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c index 85c5392..c51a9ca 100644 --- a/sys/vm/vm_map.c +++ b/sys/vm/vm_map.c @@ -711,8 +711,6 @@ vm_map_insert(vm_map_t map, vm_object_t object, vm_ooffset_t offset, vm_map_entry_t temp_entry; vm_eflags_t protoeflags; - GIANT_REQUIRED; - /* * Check that the start and end points are not bogus. */ @@ -753,6 +751,7 @@ vm_map_insert(vm_map_t map, vm_object_t object, vm_ooffset_t offset, protoeflags |= MAP_ENTRY_NOCOREDUMP; if (object) { + GIANT_REQUIRED; /* * When object is non-NULL, it could be shared with another * process. We have to set or clear OBJ_ONEMAPPING @@ -847,6 +846,7 @@ vm_map_insert(vm_map_t map, vm_object_t object, vm_ooffset_t offset, #endif if (cow & (MAP_PREFAULT|MAP_PREFAULT_PARTIAL)) { + GIANT_REQUIRED; pmap_object_init_pt(map->pmap, start, object, OFF_TO_IDX(offset), end - start, cow & MAP_PREFAULT_PARTIAL); diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index d046941..b07d6b8 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -1813,18 +1813,17 @@ again: * The object must *not* be locked. */ boolean_t -vm_object_coalesce(vm_object_t prev_object, vm_pindex_t prev_pindex, vm_size_t prev_size, vm_size_t next_size) +vm_object_coalesce(vm_object_t prev_object, vm_pindex_t prev_pindex, + vm_size_t prev_size, vm_size_t next_size) { vm_pindex_t next_pindex; - GIANT_REQUIRED; - - if (prev_object == NULL) { + if (prev_object == NULL) return (TRUE); - } - + mtx_lock(&Giant); if (prev_object->type != OBJT_DEFAULT && prev_object->type != OBJT_SWAP) { + mtx_unlock(&Giant); return (FALSE); } @@ -1839,6 +1838,7 @@ vm_object_coalesce(vm_object_t prev_object, vm_pindex_t prev_pindex, vm_size_t p * pages not mapped to prev_entry may be in use anyway) */ if (prev_object->backing_object != NULL) { + mtx_unlock(&Giant); return (FALSE); } @@ -1848,6 +1848,7 @@ vm_object_coalesce(vm_object_t prev_object, vm_pindex_t prev_pindex, vm_size_t p if ((prev_object->ref_count > 1) && (prev_object->size != next_pindex)) { + mtx_unlock(&Giant); return (FALSE); } @@ -1870,6 +1871,7 @@ vm_object_coalesce(vm_object_t prev_object, vm_pindex_t prev_pindex, vm_size_t p if (next_pindex + next_size > prev_object->size) prev_object->size = next_pindex + next_size; + mtx_unlock(&Giant); return (TRUE); } |