Discussion:
Upgrade session before quota exceedes
Denis Huber
2016-08-25 14:32:17 UTC
Permalink
Dear Genode community,

I want to dynamically create Region maps through an RM session (amount
not known at compile time). If the RAM quota of the session exceedes, I
want to upgrade the RAM quota of the session.

For this case I wrote a small test [1] which creates Region maps until
an exception is thrown and I tried to catch it. I realized that the
exception was thrown in another thread (core's entrypoint probably),
meaning I cannot catch it in my test component's thread.

[1]
https://github.com/702nADOS/genode-CheckpointRestore-SharedMemory/blob/0a78b31ca5b45ec2a21ebc8229f6b18f54c8c7bd/src/test/stress_rm_creation/main.cc

For a better insight I logged the RAM quota consumption in
Rm_session_component::create. The output of my test looks as follows:

[init -> rm_stresser] --- Rm-creation-stresser started ---
[init -> rm_stresser] Round 0
Alloc avail: 49152
[init -> rm_stresser] Round 1
Alloc avail: 36864
[init -> rm_stresser] Round 2
Alloc avail: 24576
[init -> rm_stresser] Round 3
Alloc avail: 12288
[init -> rm_stresser] Round 4
Alloc avail: 0
[init -> rm_stresser] Round 5
Quota exceeded! amount=61440, size=8192, consumed=61440
Uncaught exception of type 'Genode::Allocator::Out_of_memory'
Warning: abort called - thread: entrypoint

Is there an easy way to upgrade a session's RAM quota before allocating
objects with no available RAM?
If there is already a component in Genode which solves my problem, I
would love to see the source code :)


Kind regards,
Denis

------------------------------------------------------------------------------
Norman Feske
2016-08-25 14:32:03 UTC
Permalink
Hi Denis,
Post by Denis Huber
Alloc avail: 0
[init -> rm_stresser] Round 5
Quota exceeded! amount=61440, size=8192, consumed=61440
Uncaught exception of type 'Genode::Allocator::Out_of_memory'
Warning: abort called - thread: entrypoint
Is there an easy way to upgrade a session's RAM quota before allocating
objects with no available RAM?
you did everything correctly. The problem is actually that core's RM
service misses to catch the 'Allocator::Out_of_memory' exception. The
attached patch rectifies this. In your test program, you need to catch
'Region_map::Out_of_metadata' instead of 'Allocator::Out_of_memory'.
With this minor change, the test passes.

Thank you very much for pointing us to this problem and for the
super-convenient test case! :-)

Cheers
Norman
--
Dr.-Ing. Norman Feske
Genode Labs

http://www.genode-labs.com · http://genode.org

Genode Labs GmbH · Amtsgericht Dresden · HRB 28424 · Sitz Dresden
Geschäftsführer: Dr.-Ing. Norman Feske, Christian Helmuth
Denis Huber
2016-08-25 15:07:09 UTC
Permalink
No problem, thanks for the fast answer and the patch :)
Post by Norman Feske
Hi Denis,
Post by Denis Huber
Alloc avail: 0
[init -> rm_stresser] Round 5
Quota exceeded! amount=61440, size=8192, consumed=61440
Uncaught exception of type 'Genode::Allocator::Out_of_memory'
Warning: abort called - thread: entrypoint
Is there an easy way to upgrade a session's RAM quota before allocating
objects with no available RAM?
you did everything correctly. The problem is actually that core's RM
service misses to catch the 'Allocator::Out_of_memory' exception. The
attached patch rectifies this. In your test program, you need to catch
'Region_map::Out_of_metadata' instead of 'Allocator::Out_of_memory'.
With this minor change, the test passes.
Thank you very much for pointing us to this problem and for the
super-convenient test case! :-)
Cheers
Norman
------------------------------------------------------------------------------
_______________________________________________
genode-main mailing list
https://lists.sourceforge.net/lists/listinfo/genode-main
------------------------------------------------------------------------------
Loading...