mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-18 02:40:08 +00:00
sel4: flush vm pages on out of index pressure
re-create semantic as done before commit "core: kernel-agnostic 'Mapping' type" Issue #4751
This commit is contained in:
parent
d089e80906
commit
c8cf33a251
@ -248,25 +248,31 @@ void Vm_session_component::_attach_vm_memory(Dataspace_component &dsc,
|
||||
addr_t const guest_phys,
|
||||
Attach_attr const attribute)
|
||||
{
|
||||
Vm_space::Map_attr const attr {
|
||||
Vm_space::Map_attr const attr_noflush {
|
||||
.cached = (dsc.cacheability() == CACHED),
|
||||
.write_combined = (dsc.cacheability() == WRITE_COMBINED),
|
||||
.writeable = dsc.writeable() && attribute.writeable,
|
||||
.executable = attribute.executable,
|
||||
.flush_support = false };
|
||||
|
||||
Vm_space::Map_attr const attr_flush {
|
||||
.cached = (dsc.cacheability() == CACHED),
|
||||
.write_combined = (dsc.cacheability() == WRITE_COMBINED),
|
||||
.writeable = dsc.writeable() && attribute.writeable,
|
||||
.executable = attribute.executable,
|
||||
.flush_support = true };
|
||||
|
||||
Flexpage_iterator flex(dsc.phys_addr() + attribute.offset, attribute.size,
|
||||
guest_phys, attribute.size, guest_phys);
|
||||
|
||||
Flexpage page = flex.page();
|
||||
while (page.valid()) {
|
||||
enum { NO_FLUSH = false, FLUSH = true };
|
||||
try {
|
||||
try {
|
||||
_vm_space.alloc_guest_page_tables(page.hotspot, 1 << page.log2_order);
|
||||
|
||||
_vm_space.map_guest(page.addr, page.hotspot,
|
||||
(1 << page.log2_order) / 4096, attr);
|
||||
(1 << page.log2_order) / 4096, attr_noflush);
|
||||
} catch (Page_table_registry::Mapping_cache_full full) {
|
||||
if (full.reason == Page_table_registry::Mapping_cache_full::MEMORY) {
|
||||
if (_ram_quota_guard().limit().value > 4 * 1024 * 1024)
|
||||
@ -299,7 +305,7 @@ void Vm_session_component::_attach_vm_memory(Dataspace_component &dsc,
|
||||
}
|
||||
|
||||
_vm_space.map_guest(page.addr, page.hotspot,
|
||||
(1 << page.log2_order) / 4096, attr);
|
||||
(1 << page.log2_order) / 4096, attr_flush);
|
||||
} catch (Vm_space::Alloc_page_table_failed) {
|
||||
Genode::error("alloc page table failed");
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user