o Remove GIANT_REQUIRED from vm_map_zfini(), vm_map_zinit(),

vm_map_create(), and vm_map_submap().
 o Make further use of a local variable in vm_map_entry_splay()
   that caches a reference to one of a vm_map_entry's children.
   (This reduces code size somewhat.)
 o Revert a part of revision 1.66, deinlining vmspace_pmap().
   (This function is MPSAFE.)
This commit is contained in:
alc 2002-06-01 22:41:43 +00:00
parent f70773e964
commit 2abbbe7b8a
2 changed files with 15 additions and 25 deletions

View File

@ -191,7 +191,6 @@ vm_map_zfini(void *mem, int size)
{
vm_map_t map;
GIANT_REQUIRED;
map = (vm_map_t)mem;
lockdestroy(&map->lock);
@ -202,8 +201,6 @@ vm_map_zinit(void *mem, int size)
{
vm_map_t map;
GIANT_REQUIRED;
map = (vm_map_t)mem;
map->nentries = 0;
map->size = 0;
@ -426,12 +423,6 @@ _vm_map_clear_recursive(vm_map_t map, const char *file, int line)
{
}
struct pmap *
vmspace_pmap(struct vmspace *vmspace)
{
return &vmspace->vm_pmap;
}
long
vmspace_resident_count(struct vmspace *vmspace)
{
@ -450,8 +441,6 @@ vm_map_create(pmap_t pmap, vm_offset_t min, vm_offset_t max)
{
vm_map_t result;
GIANT_REQUIRED;
result = uma_zalloc(mapzone, M_WAITOK);
CTR1(KTR_VM, "vm_map_create: %p", result);
_vm_map_init(result, min, max);
@ -544,39 +533,35 @@ vm_map_entry_splay(vm_offset_t address, vm_map_entry_t root)
if (root == NULL)
return (root);
lefttreemax = righttreemin = &dummy;
for (;;) {
for (;; root = y) {
if (address < root->start) {
if (root->left == NULL)
if ((y = root->left) == NULL)
break;
if (address < root->left->start) {
if (address < y->start) {
/* Rotate right. */
y = root->left;
root->left = y->right;
y->right = root;
root = y;
if (root->left == NULL)
if ((y = root->left) == NULL)
break;
}
/* Link into the new root's right tree. */
righttreemin->left = root;
righttreemin = root;
root = root->left;
} else if (address >= root->end) {
if (root->right == NULL)
if ((y = root->right) == NULL)
break;
if (address >= root->right->end) {
if (address >= y->end) {
/* Rotate left. */
y = root->right;
root->right = y->left;
y->left = root;
root = y;
if (root->right == NULL)
if ((y = root->right) == NULL)
break;
}
/* Link into the new root's left tree. */
lefttreemax->right = root;
lefttreemax = root;
root = root->right;
} else
break;
}
@ -1176,8 +1161,6 @@ vm_map_submap(
vm_map_entry_t entry;
int result = KERN_INVALID_ARGUMENT;
GIANT_REQUIRED;
vm_map_lock(map);
VM_MAP_RANGE_CHECK(map, start, end);

View File

@ -217,6 +217,14 @@ struct vmspace {
struct proc *vm_freer; /* vm freed on whose behalf */
};
#ifdef _KERNEL
static __inline pmap_t
vmspace_pmap(struct vmspace *vmspace)
{
return &vmspace->vm_pmap;
}
#endif /* _KERNEL */
#ifdef _KERNEL
/*
* Macros: vm_map_lock, etc.
@ -252,7 +260,6 @@ void _vm_map_clear_recursive(vm_map_t map, const char *file, int line);
#define vm_map_clear_recursive(map) \
_vm_map_clear_recursive(map, LOCK_FILE, LOCK_LINE)
struct pmap *vmspace_pmap(struct vmspace *vmspace);
long vmspace_resident_count(struct vmspace *vmspace);
#endif /* _KERNEL */