summaryrefslogtreecommitdiffstats
path: root/sys/vm
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2002-05-12 05:22:56 +0000
committeralc <alc@FreeBSD.org>2002-05-12 05:22:56 +0000
commite7bbea38d981582adb68f002d1abf784b0ea7047 (patch)
treeb9a492a1fc3377262b2f1fa1e9406faa0940c5b8 /sys/vm
parent34259ca95142f09cfa9e46200da392f409f7f039 (diff)
downloadFreeBSD-src-e7bbea38d981582adb68f002d1abf784b0ea7047.zip
FreeBSD-src-e7bbea38d981582adb68f002d1abf784b0ea7047.tar.gz
o Acquire and release Giant in vm_object_reference() and
vm_object_deallocate(), replacing the assertion GIANT_REQUIRED. o Remove GIANT_REQUIRED from vm_map_protect() and vm_map_simplify_entry(). o Acquire and release Giant around vm_map_protect()'s call to pmap_protect(). Altogether, these changes eliminate the need for mprotect() to acquire and release Giant.
Diffstat (limited to 'sys/vm')
-rw-r--r--sys/vm/vm_map.c5
-rw-r--r--sys/vm/vm_object.c15
2 files changed, 9 insertions, 11 deletions
diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c
index 5cb8f98..fb690e9 100644
--- a/sys/vm/vm_map.c
+++ b/sys/vm/vm_map.c
@@ -938,8 +938,6 @@ vm_map_simplify_entry(vm_map_t map, vm_map_entry_t entry)
vm_map_entry_t next, prev;
vm_size_t prevsize, esize;
- GIANT_REQUIRED;
-
if (entry->eflags & MAP_ENTRY_IS_SUB_MAP)
return;
@@ -1187,7 +1185,6 @@ vm_map_protect(vm_map_t map, vm_offset_t start, vm_offset_t end,
vm_map_entry_t current;
vm_map_entry_t entry;
- GIANT_REQUIRED;
vm_map_lock(map);
VM_MAP_RANGE_CHECK(map, start, end);
@@ -1237,12 +1234,14 @@ vm_map_protect(vm_map_t map, vm_offset_t start, vm_offset_t end,
* here -- CHECK THIS XXX
*/
if (current->protection != old_prot) {
+ mtx_lock(&Giant);
#define MASK(entry) (((entry)->eflags & MAP_ENTRY_COW) ? ~VM_PROT_WRITE : \
VM_PROT_ALL)
pmap_protect(map->pmap, current->start,
current->end,
current->protection & MASK(current));
#undef MASK
+ mtx_unlock(&Giant);
}
vm_map_simplify_entry(map, current);
current = current->next;
diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c
index 352ad2f..0db982e 100644
--- a/sys/vm/vm_object.c
+++ b/sys/vm/vm_object.c
@@ -360,11 +360,10 @@ vm_object_allocate(objtype_t type, vm_size_t size)
void
vm_object_reference(vm_object_t object)
{
- GIANT_REQUIRED;
-
if (object == NULL)
return;
+ mtx_lock(&Giant);
#if 0
/* object can be re-referenced during final cleaning */
KASSERT(!(object->flags & OBJ_DEAD),
@@ -377,6 +376,7 @@ vm_object_reference(vm_object_t object)
printf("vm_object_reference: delay in getting object\n");
}
}
+ mtx_unlock(&Giant);
}
/*
@@ -427,12 +427,12 @@ vm_object_deallocate(vm_object_t object)
{
vm_object_t temp;
- GIANT_REQUIRED;
-
+ mtx_lock(&Giant);
while (object != NULL) {
if (object->type == OBJT_VNODE) {
vm_object_vndeallocate(object);
+ mtx_unlock(&Giant);
return;
}
@@ -447,6 +447,7 @@ vm_object_deallocate(vm_object_t object)
*/
object->ref_count--;
if (object->ref_count > 1) {
+ mtx_unlock(&Giant);
return;
} else if (object->ref_count == 1) {
if (object->shadow_count == 0) {
@@ -487,13 +488,10 @@ vm_object_deallocate(vm_object_t object)
continue;
}
}
-
+ mtx_unlock(&Giant);
return;
-
}
-
doterm:
-
temp = object->backing_object;
if (temp) {
TAILQ_REMOVE(&temp->shadow_head, object, shadow_list);
@@ -514,6 +512,7 @@ doterm:
vm_object_terminate(object);
object = temp;
}
+ mtx_unlock(&Giant);
}
/*
OpenPOWER on IntegriCloud