Skip to content
Snippets Groups Projects
  • Raphael S. Carvalho's avatar
    0560d33f
    bsd: Register ARC shrinker · 0560d33f
    Raphael S. Carvalho authored
    
    This patch registers the ARC shrinker by using the event handler
    list from BSD side. When ARC is initialized, it inserts the lowmem event
    handler into an external event handler list. lowmem basically signals
    the reclaiming thread which will then wake up to decide which approach
    should be used to shrink the ARC.
    
    The memory pressure on OSv is activated when the 20% watermark is
    reached, so the shrink policy will decide which shrinker should
    be called on such events.
    
    bsd_shrinker_init is the responsible to find the lowmem event handler
    from the external list, and integrate it into our shrinker infrastructure.
    
    arc_lowmem needed few changes to return the amount of released memory
    from the ARC.
    
    Glauber and I tested the functionality by filling up the ARC up
    to its target, then allocating as much memory as possible to see
    if the ARC shrinker would take place to release memory back to
    the operating system.
    
    Signed-off-by: default avatarGlauber Costa <glommer@cloudius-systems.com>
    Signed-off-by: default avatarRaphael S. Carvalho <raphaelsc@cloudius-systems.com>
    Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
    0560d33f
    History
    bsd: Register ARC shrinker
    Raphael S. Carvalho authored
    
    This patch registers the ARC shrinker by using the event handler
    list from BSD side. When ARC is initialized, it inserts the lowmem event
    handler into an external event handler list. lowmem basically signals
    the reclaiming thread which will then wake up to decide which approach
    should be used to shrink the ARC.
    
    The memory pressure on OSv is activated when the 20% watermark is
    reached, so the shrink policy will decide which shrinker should
    be called on such events.
    
    bsd_shrinker_init is the responsible to find the lowmem event handler
    from the external list, and integrate it into our shrinker infrastructure.
    
    arc_lowmem needed few changes to return the amount of released memory
    from the ARC.
    
    Glauber and I tested the functionality by filling up the ARC up
    to its target, then allocating as much memory as possible to see
    if the ARC shrinker would take place to release memory back to
    the operating system.
    
    Signed-off-by: default avatarGlauber Costa <glommer@cloudius-systems.com>
    Signed-off-by: default avatarRaphael S. Carvalho <raphaelsc@cloudius-systems.com>
    Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>