core: remove redundant datastructure
Avl allocator provides a method to lookup any element, which is sufficient to find all regions to destruct. Issue #2173
This commit is contained in:
parent
82443ddee6
commit
3c4372210e
|
@ -285,12 +285,8 @@ class Genode::Region_map_component : public Genode::Weak_object<Genode::Region_m
|
||||||
typedef Tslab<Rm_region_ref, get_page_size() - Sliced_heap::meta_data_size()>
|
typedef Tslab<Rm_region_ref, get_page_size() - Sliced_heap::meta_data_size()>
|
||||||
Ref_slab;
|
Ref_slab;
|
||||||
|
|
||||||
Ref_slab _ref_slab; /* backing store for
|
|
||||||
region list */
|
|
||||||
Allocator_avl_tpl<Rm_region> _map; /* region map for attach,
|
Allocator_avl_tpl<Rm_region> _map; /* region map for attach,
|
||||||
detach, pagefaults */
|
detach, pagefaults */
|
||||||
List<Rm_region_ref> _regions; /* region list for destruction */
|
|
||||||
|
|
||||||
Fifo<Rm_faulter> _faulters; /* list of threads that faulted at
|
Fifo<Rm_faulter> _faulters; /* list of threads that faulted at
|
||||||
the region map and wait
|
the region map and wait
|
||||||
for fault resolution */
|
for fault resolution */
|
||||||
|
|
|
@ -392,16 +392,6 @@ Region_map_component::attach(Dataspace_capability ds_cap, size_t size,
|
||||||
_map.metadata(r, Rm_region((addr_t)r, size, true, dsc, offset, this));
|
_map.metadata(r, Rm_region((addr_t)r, size, true, dsc, offset, this));
|
||||||
Rm_region *region = _map.metadata(r);
|
Rm_region *region = _map.metadata(r);
|
||||||
|
|
||||||
/* also update region list */
|
|
||||||
Rm_region_ref *p;
|
|
||||||
try { p = new(&_ref_slab) Rm_region_ref(region); }
|
|
||||||
catch (Allocator::Out_of_memory) {
|
|
||||||
_map.free(r);
|
|
||||||
throw Out_of_metadata();
|
|
||||||
}
|
|
||||||
|
|
||||||
_regions.insert(p);
|
|
||||||
|
|
||||||
/* inform dataspace about attachment */
|
/* inform dataspace about attachment */
|
||||||
dsc->attached_to(region);
|
dsc->attached_to(region);
|
||||||
|
|
||||||
|
@ -552,16 +542,6 @@ void Region_map_component::detach(Local_addr local_addr)
|
||||||
* region maps.
|
* region maps.
|
||||||
*/
|
*/
|
||||||
unmap_managed(this, ®ion, 1);
|
unmap_managed(this, ®ion, 1);
|
||||||
|
|
||||||
/* update region list */
|
|
||||||
Rm_region_ref *p = _regions.first();
|
|
||||||
for (; p; p = p->next())
|
|
||||||
if (p->region() == region_ptr) break;
|
|
||||||
|
|
||||||
if (p) {
|
|
||||||
_regions.remove(p);
|
|
||||||
destroy(&_ref_slab, p);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -641,7 +621,6 @@ Region_map_component::Region_map_component(Rpc_entrypoint &ep,
|
||||||
:
|
:
|
||||||
_ds_ep(&ep), _thread_ep(&ep), _session_ep(&ep),
|
_ds_ep(&ep), _thread_ep(&ep), _session_ep(&ep),
|
||||||
_md_alloc(md_alloc),
|
_md_alloc(md_alloc),
|
||||||
_ref_slab(&_md_alloc),
|
|
||||||
_map(&_md_alloc), _pager_ep(&pager_ep),
|
_map(&_md_alloc), _pager_ep(&pager_ep),
|
||||||
_ds(align_addr(vm_size, get_page_size_log2())),
|
_ds(align_addr(vm_size, get_page_size_log2())),
|
||||||
_ds_cap(_type_deduction_helper(_ds_ep->manage(&_ds)))
|
_ds_cap(_type_deduction_helper(_ds_ep->manage(&_ds)))
|
||||||
|
@ -687,17 +666,17 @@ Region_map_component::~Region_map_component()
|
||||||
} while (cl);
|
} while (cl);
|
||||||
|
|
||||||
/* detach all regions */
|
/* detach all regions */
|
||||||
Rm_region_ref *ref;
|
while (true) {
|
||||||
do {
|
addr_t out_addr = 0;
|
||||||
void * local_addr;
|
|
||||||
{
|
{
|
||||||
Lock::Guard lock_guard(_lock);
|
Lock::Guard lock_guard(_lock);
|
||||||
ref = _ref_slab.first_object();
|
if (!_map.any_block_addr(&out_addr))
|
||||||
if (!ref) break;
|
break;
|
||||||
local_addr = reinterpret_cast<void *>(ref->region()->base());
|
|
||||||
}
|
}
|
||||||
detach(local_addr);
|
|
||||||
} while (ref);
|
detach(out_addr);
|
||||||
|
}
|
||||||
|
|
||||||
/* revoke dataspace representation */
|
/* revoke dataspace representation */
|
||||||
_ds_ep->dissolve(&_ds);
|
_ds_ep->dissolve(&_ds);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user