mempool: shrink memory when no longer used.
This patch introduces the memory reclaimer thread, which I hope to use to dispose of unused memory when pressure kicks in. "Pressure" right now is defined to be when we have only 20 % of total memory available. But that can be revisited. The way it will work is that each memory user that is able to dispose of its memory will register a shrinker, and the reclaimer will loop through them. However, the current "loop through all" only "works" because we have only one shrinker being registered. When other appears, we need better policies to drive how much to take, and from whom. Memory allocation will now wait if memory is not available, instead of aborting. The decision of aborting should belong to the reclaimer and no one else. We should never expect to have an unbounded and more importantly, all opaque, number of shrinkers like Linux does. We have control of who they are and how they behave, so I expect that we will be able to make a lot better decisions in the long run. Signed-off-by:Glauber Costa <glommer@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
Loading
Please register or sign in to comment