Reintroduce locking on accesses to vm_object_list.
This commit is contained in:
parent
32eb065e64
commit
a569838764
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=95112
@ -95,8 +95,10 @@ vmtotal(SYSCTL_HANDLER_ARGS)
|
||||
* Mark all objects as inactive.
|
||||
*/
|
||||
GIANT_REQUIRED;
|
||||
mtx_lock(&vm_object_list_mtx);
|
||||
TAILQ_FOREACH(object, &vm_object_list, object_list)
|
||||
vm_object_clear_flag(object, OBJ_ACTIVE);
|
||||
mtx_unlock(&vm_object_list_mtx);
|
||||
/*
|
||||
* Calculate process statistics.
|
||||
*/
|
||||
@ -164,6 +166,7 @@ vmtotal(SYSCTL_HANDLER_ARGS)
|
||||
/*
|
||||
* Calculate object memory usage statistics.
|
||||
*/
|
||||
mtx_lock(&vm_object_list_mtx);
|
||||
TAILQ_FOREACH(object, &vm_object_list, object_list) {
|
||||
/*
|
||||
* devices, like /dev/mem, will badly skew our totals
|
||||
@ -186,6 +189,7 @@ vmtotal(SYSCTL_HANDLER_ARGS)
|
||||
}
|
||||
}
|
||||
}
|
||||
mtx_unlock(&vm_object_list_mtx);
|
||||
totalp->t_free = cnt.v_free_count + cnt.v_cache_count;
|
||||
return (sysctl_handle_opaque(oidp, totalp, sizeof total, req));
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ static int vm_object_page_collect_flush(vm_object_t object, vm_page_t p, int cur
|
||||
*/
|
||||
|
||||
struct object_q vm_object_list;
|
||||
static struct mtx vm_object_list_mtx; /* lock for object list and count */
|
||||
struct mtx vm_object_list_mtx; /* lock for object list and count */
|
||||
vm_object_t kernel_object;
|
||||
vm_object_t kmem_object;
|
||||
static struct vm_object kernel_object_store;
|
||||
@ -222,7 +222,9 @@ _vm_object_allocate(objtype_t type, vm_size_t size, vm_object_t object)
|
||||
|
||||
object->generation++;
|
||||
|
||||
mtx_lock(&vm_object_list_mtx);
|
||||
TAILQ_INSERT_TAIL(&vm_object_list, object, object_list);
|
||||
mtx_unlock(&vm_object_list_mtx);
|
||||
|
||||
object_hash_rand = object->hash_rand;
|
||||
}
|
||||
@ -1511,11 +1513,13 @@ vm_object_collapse(vm_object_t object)
|
||||
KASSERT(backing_object->ref_count == 1, ("backing_object %p was somehow re-referenced during collapse!", backing_object));
|
||||
KASSERT(TAILQ_FIRST(&backing_object->memq) == NULL, ("backing_object %p somehow has left over pages during collapse!", backing_object));
|
||||
|
||||
mtx_lock(&vm_object_list_mtx);
|
||||
TAILQ_REMOVE(
|
||||
&vm_object_list,
|
||||
backing_object,
|
||||
object_list
|
||||
);
|
||||
mtx_unlock(&vm_object_list_mtx);
|
||||
|
||||
uma_zfree(obj_zone, backing_object);
|
||||
|
||||
|
@ -160,6 +160,7 @@ struct vm_object {
|
||||
TAILQ_HEAD(object_q, vm_object);
|
||||
|
||||
extern struct object_q vm_object_list; /* list of allocated objects */
|
||||
extern struct mtx vm_object_list_mtx; /* lock for object list and count */
|
||||
|
||||
extern vm_object_t kernel_object; /* the single kernel object */
|
||||
extern vm_object_t kmem_object;
|
||||
|
Loading…
Reference in New Issue
Block a user