Force a memory collection when the free memory is "low" #7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is inspired by qubes-mirage-firewall. For each incoming and outgoing packets, it tests the free memory available, and if "low" (here <=40% of the total memory) it triggers a garbage collection.
Unlike qubes-mirage-firewall, there is nothing after to the garbage collection to get more memory.
In the dom0 logs, you can see that even a continuous ping decreases the free memory (from my point of view because of some cstructs in xenstore/etc.) :
The collection was able to get nearly 4MB of memory, and the second collection got the same amount a few minutes later.
To me, this will help to keep the amount of memory requested from Qubes by the unikernel as low as possible (the idea is that Linux is able to run with 400MB memory for network functions, and keeping unikernels an order of magnitude lower is good :) ).