Skip to content
  • Rafael J. Wysocki's avatar
    [PATCH] swsusp: rework memory shrinker · d6277db4
    Rafael J. Wysocki authored
    
    
    Rework the swsusp's memory shrinker in the following way:
    
    - Simplify balance_pgdat() by removing all of the swsusp-related code
      from it.
    
    - Make shrink_all_memory() use shrink_slab() and a new function
      shrink_all_zones() which calls shrink_active_list() and
      shrink_inactive_list() directly for each zone in a way that's optimized
      for suspend.
    
    In shrink_all_memory() we try to free exactly as many pages as the caller
    asks for, preferably in one shot, starting from easier targets.   If slab
    caches are huge, they are most likely to have enough pages to reclaim.
     The inactive lists are next (the zones with more inactive pages go first)
    etc.
    
    Each time shrink_all_memory() attempts to shrink the active and inactive
    lists for each zone in 5 passes.   In the first pass, only the inactive
    lists are taken into consideration.   In the next two passes the active
    lists are also shrunk, but mapped pages are not reclaimed.   In the last
    two passes the active and inactive lists are shrunk and mapped pages are
    reclaimed as well.  The aim of this is to alter the reclaim logic to choose
    the best pages to keep on resume and improve the responsiveness of the
    resumed system.
    
    Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
    Signed-off-by: default avatarCon Kolivas <kernel@kolivas.org>
    Signed-off-by: default avatarAdrian Bunk <bunk@stusta.de>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    d6277db4