base: introduce Env::try_session

The new 'Env::try_session' method mirrors the existing 'Env::session'
without implicitly handling exceptions of the types 'Out_of_ram',
'Out_of_caps', 'Insufficient_ram_quota', and 'Insufficient_cap_quota'.
It enables runtime environments like init to reflect those exceptions to
their children instead of paying the costs of implicit session-quota
upgrades out of the own pocket.

By changing the 'Parent_service' to use 'try_session', this patch fixes
a resource-exhaustion problem of init in Sculpt OS that occurred when
the GPU multiplexer created a large batch of IO_MEM sessions, with each
session requiring a second attempt with the session quota upgraded by
4 KiB.

Issue #3767
This commit is contained in:
Norman Feske
2021-10-08 15:15:41 +02:00
parent d5d7915b4d
commit 6f1d3862cd
7 changed files with 153 additions and 41 deletions

View File

@ -40,7 +40,7 @@ class Sandbox::Abandonable : Interface
};
class Sandbox::Parent_service : public Genode::Parent_service, public Abandonable
class Sandbox::Parent_service : public Genode::Try_parent_service, public Abandonable
{
private:
@ -51,7 +51,7 @@ class Sandbox::Parent_service : public Genode::Parent_service, public Abandonabl
Parent_service(Registry<Parent_service> &registry, Env &env,
Service::Name const &name)
:
Genode::Parent_service(env, name), _reg_elem(registry, *this)
Genode::Try_parent_service(env, name), _reg_elem(registry, *this)
{ }
};