kernel: rebuild object ref-counting using atomic types
This commit is contained in:
@@ -47,7 +47,7 @@ enum search_direction {
|
||||
SEARCH_RIGHT,
|
||||
};
|
||||
|
||||
static kern_status_t address_space_cleanup(struct object *obj, struct queue *q);
|
||||
static kern_status_t address_space_cleanup(struct object *obj);
|
||||
|
||||
static struct object_type address_space_type = {
|
||||
.ob_name = "address-space",
|
||||
@@ -664,9 +664,10 @@ static void area_unmap(struct vm_area *area)
|
||||
}
|
||||
}
|
||||
|
||||
static kern_status_t address_space_cleanup(struct object *obj, struct queue *q)
|
||||
static kern_status_t address_space_cleanup(struct object *obj)
|
||||
{
|
||||
struct address_space *space = ADDRESS_SPACE_CAST(obj);
|
||||
tracek("begin address space cleanup %p", space);
|
||||
struct btree_node *cur = btree_first(&space->s_mappings);
|
||||
while (cur) {
|
||||
struct btree_node *next = btree_next(cur);
|
||||
@@ -680,6 +681,20 @@ static kern_status_t address_space_cleanup(struct object *obj, struct queue *q)
|
||||
cur = next;
|
||||
}
|
||||
|
||||
cur = btree_first(&space->s_reserved);
|
||||
while (cur) {
|
||||
struct btree_node *next = btree_next(cur);
|
||||
struct vm_area *area
|
||||
= BTREE_CONTAINER(struct vm_area, vma_node, cur);
|
||||
btree_delete(&space->s_reserved, cur);
|
||||
|
||||
delete_area(area, space);
|
||||
vm_cache_free(&vm_area_cache, area);
|
||||
|
||||
cur = next;
|
||||
}
|
||||
|
||||
tracek("end address space cleanup %p", space);
|
||||
return KERN_OK;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user