Increase slab-block size in signal component

The backend allocator for the slab is a sliced heap, which hands out
allocations with page-size granularity (4096 bytes). Therefore, the
slab-block size should also be about a multiple of the page size minus
some bytes of overhead.

Additional adjustments:

- The slab-block size and the default quota-upgrade amount for SIGNAL
  sessions depends on the platform bit width now.
- The signal test also stresses the case of many managed context in one
  session including creation and destruction of the used signal receiver
  in repeated rounds.
This commit is contained in:
Christian Helmuth 2014-10-02 19:47:36 +02:00
parent aea35ee7d2
commit e9032904a3
3 changed files with 30 additions and 3 deletions

View File

@ -295,8 +295,13 @@ Signal_context_capability Signal_receiver::manage(Signal_context *context)
if (try_again)
break;
PINF("upgrading quota donation for SIGNAL session");
env()->parent()->upgrade(signal_connection()->cap(), "ram_quota=4K");
size_t const quota = 1024*sizeof(long);
char buf[64];
snprintf(buf, sizeof(buf), "ram_quota=%zu", quota);
PINF("upgrading quota donation for SIGNAL session (%zu bytes)", quota);
env()->parent()->upgrade(signal_connection()->cap(), buf);
try_again = true;
}
} while (try_again);

View File

@ -143,7 +143,8 @@ namespace Genode {
Signal_source_component _source;
Signal_source_capability _source_cap;
Allocator_guard _md_alloc;
Tslab<Signal_context_component, 1024> _contexts_slab;
Tslab<Signal_context_component,
960*sizeof(long)> _contexts_slab;
Ipc_ostream *_ipc_ostream;
public:

View File

@ -562,6 +562,7 @@ class Signal_context_destroyer : public Thread<4096>
}
};
static void synchronized_context_destruction_test()
{
Signal_receiver receiver;
@ -598,6 +599,25 @@ static void synchronized_context_destruction_test()
}
static void many_managed_contexts()
{
for (unsigned round = 0; round < 10; ++round) {
unsigned const num_contexts = 200 + 5*round;
printf("round %u: create and manage %u contexts\n", round, num_contexts);
Signal_receiver rec;
for (unsigned i = 0; i < num_contexts; ++i) {
Id_signal_context *context = new (env()->heap()) Id_signal_context(i);
rec.manage(context);
}
}
printf("many contexts finished\n");
}
/**
* Main program
*/
@ -611,6 +631,7 @@ int main(int, char **)
lazy_receivers_test();
check_context_management();
synchronized_context_destruction_test();
many_managed_contexts();
printf("--- signalling test finished ---\n");
return 0;