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:
Norman Feske 2017-05-08 11:25:11 +02:00 committed by Christian Helmuth
parent 5b1e3466be
commit 82a98065a0

View File

@ -115,17 +115,14 @@ Cap_space::Cap_space() : _slab(nullptr, &_initial_sb) { }
void Cap_space::upgrade_slab(Allocator &alloc) void Cap_space::upgrade_slab(Allocator &alloc)
{ {
for (;;) { enum { NEEDED_AVAIL_ENTRIES_FOR_SUCCESSFUL_SYSCALL = 8 };
void *block = nullptr;
/* if (_slab.avail_entries() > NEEDED_AVAIL_ENTRIES_FOR_SUCCESSFUL_SYSCALL)
* On every upgrade we try allocating as many blocks as possible. return;
* If the underlying allocator complains that its quota is exceeded
* this is normal as we use it as indication when to exit the loop. void *block = nullptr;
*/ if (alloc.alloc(SLAB_SIZE, &block))
if (!alloc.alloc(SLAB_SIZE, &block)) return;
_slab.insert_sb(block); _slab.insert_sb(block);
}
} }