Reduce the size of a vm object by converting its shadow list from a TAILQ

to a LIST.

Approved by:	re (rwatson)
This commit is contained in:
alc 2003-05-18 04:10:16 +00:00
parent 64bd3d4ac2
commit e90c007e3f
2 changed files with 12 additions and 24 deletions

View File

@ -194,7 +194,7 @@ _vm_object_allocate(objtype_t type, vm_pindex_t size, vm_object_t object)
int incr;
TAILQ_INIT(&object->memq);
TAILQ_INIT(&object->shadow_head);
LIST_INIT(&object->shadow_head);
object->root = NULL;
object->type = type;
@ -475,7 +475,7 @@ vm_object_deallocate(vm_object_t object)
object->type == OBJT_SWAP)) {
vm_object_t robject;
robject = TAILQ_FIRST(&object->shadow_head);
robject = LIST_FIRST(&object->shadow_head);
KASSERT(robject != NULL,
("vm_object_deallocate: ref_count: %d, shadow_count: %d",
object->ref_count,
@ -513,7 +513,7 @@ vm_object_deallocate(vm_object_t object)
temp = object->backing_object;
if (temp != NULL) {
VM_OBJECT_LOCK(temp);
TAILQ_REMOVE(&temp->shadow_head, object, shadow_list);
LIST_REMOVE(object, shadow_list);
temp->shadow_count--;
temp->generation++;
VM_OBJECT_UNLOCK(temp);
@ -1123,7 +1123,7 @@ vm_object_shadow(
result->backing_object = source;
if (source != NULL) {
VM_OBJECT_LOCK(source);
TAILQ_INSERT_TAIL(&source->shadow_head, result, shadow_list);
LIST_INSERT_HEAD(&source->shadow_head, result, shadow_list);
source->shadow_count++;
source->generation++;
if (length < source->size)
@ -1193,7 +1193,7 @@ vm_object_split(vm_map_entry_t entry)
if (source != NULL) {
vm_object_reference(source); /* Referenced by new_object */
VM_OBJECT_LOCK(source);
TAILQ_INSERT_TAIL(&source->shadow_head,
LIST_INSERT_HEAD(&source->shadow_head,
new_object, shadow_list);
source->shadow_count++;
source->generation++;
@ -1568,20 +1568,12 @@ vm_object_collapse(vm_object_t object)
* backing_object->backing_object moves from within
* backing_object to within object.
*/
TAILQ_REMOVE(
&backing_object->shadow_head,
object,
shadow_list
);
LIST_REMOVE(object, shadow_list);
backing_object->shadow_count--;
backing_object->generation++;
if (backing_object->backing_object) {
VM_OBJECT_LOCK(backing_object->backing_object);
TAILQ_REMOVE(
&backing_object->backing_object->shadow_head,
backing_object,
shadow_list
);
LIST_REMOVE(backing_object, shadow_list);
backing_object->backing_object->shadow_count--;
backing_object->backing_object->generation++;
VM_OBJECT_UNLOCK(backing_object->backing_object);
@ -1589,7 +1581,7 @@ vm_object_collapse(vm_object_t object)
object->backing_object = backing_object->backing_object;
if (object->backing_object) {
VM_OBJECT_LOCK(object->backing_object);
TAILQ_INSERT_TAIL(
LIST_INSERT_HEAD(
&object->backing_object->shadow_head,
object,
shadow_list
@ -1641,11 +1633,7 @@ vm_object_collapse(vm_object_t object)
* it, since its reference count is at least 2.
*/
VM_OBJECT_LOCK(backing_object);
TAILQ_REMOVE(
&backing_object->shadow_head,
object,
shadow_list
);
LIST_REMOVE(object, shadow_list);
backing_object->shadow_count--;
backing_object->generation++;
VM_OBJECT_UNLOCK(backing_object);
@ -1654,7 +1642,7 @@ vm_object_collapse(vm_object_t object)
if ((object->backing_object = new_backing_object) != NULL) {
vm_object_reference(new_backing_object);
VM_OBJECT_LOCK(new_backing_object);
TAILQ_INSERT_TAIL(
LIST_INSERT_HEAD(
&new_backing_object->shadow_head,
object,
shadow_list

View File

@ -92,8 +92,8 @@ typedef u_char objtype_t;
struct vm_object {
struct mtx mtx;
TAILQ_ENTRY(vm_object) object_list; /* list of all objects */
TAILQ_HEAD(, vm_object) shadow_head; /* objects that this is a shadow for */
TAILQ_ENTRY(vm_object) shadow_list; /* chain of shadow objects */
LIST_HEAD(, vm_object) shadow_head; /* objects that this is a shadow for */
LIST_ENTRY(vm_object) shadow_list; /* chain of shadow objects */
TAILQ_HEAD(, vm_page) memq; /* list of resident pages */
vm_page_t root; /* root of the resident page splay tree */
int generation; /* generation ID */