• C
    [PATCH] zone_reclaim: dynamic slab reclaim · 0ff38490
    Christoph Lameter 提交于
    Currently one can enable slab reclaim by setting an explicit option in
    /proc/sys/vm/zone_reclaim_mode.  Slab reclaim is then used as a final
    option if the freeing of unmapped file backed pages is not enough to free
    enough pages to allow a local allocation.
    
    However, that means that the slab can grow excessively and that most memory
    of a node may be used by slabs.  We have had a case where a machine with
    46GB of memory was using 40-42GB for slab.  Zone reclaim was effective in
    dealing with pagecache pages.  However, slab reclaim was only done during
    global reclaim (which is a bit rare on NUMA systems).
    
    This patch implements slab reclaim during zone reclaim.  Zone reclaim
    occurs if there is a danger of an off node allocation.  At that point we
    
    1. Shrink the per node page cache if the number of pagecache
       pages is more than min_unmapped_ratio percent of pages in a zone.
    
    2. Shrink the slab cache if the number of the nodes reclaimable slab pages
       (patch depends on earlier one that implements that counter)
       are more than min_slab_ratio (a new /proc/sys/vm tunable).
    
    The shrinking of the slab cache is a bit problematic since it is not node
    specific.  So we simply calculate what point in the slab we want to reach
    (current per node slab use minus the number of pages that neeed to be
    allocated) and then repeately run the global reclaim until that is
    unsuccessful or we have reached the limit.  I hope we will have zone based
    slab reclaim at some point which will make that easier.
    
    The default for the min_slab_ratio is 5%
    
    Also remove the slab option from /proc/sys/vm/zone_reclaim_mode.
    
    [akpm@osdl.org: cleanups]
    Signed-off-by: NChristoph Lameter <clameter@sgi.com>
    Signed-off-by: NAndrew Morton <akpm@osdl.org>
    Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
    0ff38490
vmscan.c 44.5 KB