Skip to content
Snippets Groups Projects
  • Glauber Costa's avatar
    4afd087b
    mempool: shrink memory when no longer used. · 4afd087b
    Glauber Costa authored
    
    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: default avatarGlauber Costa <glommer@cloudius-systems.com>
    Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
    4afd087b
    History
    mempool: shrink memory when no longer used.
    Glauber Costa authored
    
    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: default avatarGlauber Costa <glommer@cloudius-systems.com>
    Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>