mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-19 13:47:56 +00:00
base-hw: upgrade cap-space slab less eagerly
This patch upgrades the cap-space slab only if the kernel runs out of entries, instead of consuming as much PD-session quota as possible. Until now, the behavior worked well because the cap-space slab was the only consumer of PD-session quota. However, once we start accounting all PD session meta data - and eventually merging the PD and RAM services - the aggressive scheme stands in the way. Issue #2398
This commit is contained in:
parent
5b1e3466be
commit
82a98065a0
@ -115,17 +115,14 @@ Cap_space::Cap_space() : _slab(nullptr, &_initial_sb) { }
|
||||
|
||||
void Cap_space::upgrade_slab(Allocator &alloc)
|
||||
{
|
||||
for (;;) {
|
||||
void *block = nullptr;
|
||||
enum { NEEDED_AVAIL_ENTRIES_FOR_SUCCESSFUL_SYSCALL = 8 };
|
||||
|
||||
/*
|
||||
* On every upgrade we try allocating as many blocks as possible.
|
||||
* If the underlying allocator complains that its quota is exceeded
|
||||
* this is normal as we use it as indication when to exit the loop.
|
||||
*/
|
||||
if (!alloc.alloc(SLAB_SIZE, &block)) return;
|
||||
if (_slab.avail_entries() > NEEDED_AVAIL_ENTRIES_FOR_SUCCESSFUL_SYSCALL)
|
||||
return;
|
||||
|
||||
void *block = nullptr;
|
||||
if (alloc.alloc(SLAB_SIZE, &block))
|
||||
_slab.insert_sb(block);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user