From 99bdfbe36fa9f52bb3a51444c0220b3a88fb3b28 Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Tue, 1 Sep 2020 14:01:57 +0200 Subject: [PATCH] trace: don't account argument_buffer 2x The quota for the argument buffer is already accounted by using the Attached_ram_dataspace _argument_buffer, which uses the Constraint_ram_allocator _ram, which uses the Ram_quota_guard from the Session_object. Running on Sculpt with more than 1000 Subject_info objects/trace IDs the memory waste become noticeable. --- repos/base/src/core/trace_session_component.cc | 4 +--- repos/os/src/app/top/main.cc | 9 +++++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/repos/base/src/core/trace_session_component.cc b/repos/base/src/core/trace_session_component.cc index 12fe8989bd..9fa394f398 100644 --- a/repos/base/src/core/trace_session_component.cc +++ b/repos/base/src/core/trace_session_component.cc @@ -187,9 +187,7 @@ Session_component::Session_component(Rpc_entrypoint &ep, _policies(policies), _subjects(_subjects_slab, _ram, _sources), _argument_buffer(_ram, local_rm, arg_buffer_size) -{ - withdraw(Ram_quota{_argument_buffer.size()}); -} +{ } Session_component::~Session_component() diff --git a/repos/os/src/app/top/main.cc b/repos/os/src/app/top/main.cc index 4cb43c17f7..44705589a3 100644 --- a/repos/os/src/app/top/main.cc +++ b/repos/os/src/app/top/main.cc @@ -286,8 +286,8 @@ struct App::Main PARENT_LEVELS = 0 }; - size_t trace_ram_quota { 20 * 4096 }; - size_t arg_buffer_ram { 10 * 4096 }; + size_t arg_buffer_ram { 12 * 4096 }; /* ~ 190 trace Subject_info objects */ + size_t trace_ram_quota { arg_buffer_ram + 4 * 4096 }; Reconstructible _trace { _env, trace_ram_quota, @@ -359,8 +359,9 @@ void App::Main::_handle_period() return; } - trace_ram_quota += 4096; - arg_buffer_ram += 4 * 4096; + enum { ARG_RAM_UPGRADE = 4 * 4096 }; + trace_ram_quota += ARG_RAM_UPGRADE; + arg_buffer_ram += ARG_RAM_UPGRADE; /* by destructing the session we free up the allocated memory in core */ Genode::warning("re-construct trace session");