• Andrew Morton's avatar
    [PATCH] kswapd: avoid unnecessary reclaiming from higher zones · 9ef935c2
    Andrew Morton authored
    Currently kswapd walks across all zones in dma->normal->highmem order,
    performing proportional scanning until all zones are OK.  This means that
    pressure against ZONE_NORMAL causes unnecessary reclaim of ZONE_HIGHMEM.
    
    To fix that up we change kswapd so that it walks the zones in the
    high->normal->dma direction, skipping zones which are OK.  Once it encounters
    a zone which needs some reclaim kswapd will perform proportional scanning
    against that zone as well as all the succeeding lower zones.
    
    We scan the lower zones even if they have sufficient free pages.  This is
    because
    
    a) the lower zone may be above pages_high, but because of the incremental
       min, the lower zone may still not be eligible for allocations.  That's bad
       because cache in that lower zone will then not be scanned at the correct
       rate.
    
    b) pages in this lower zone are usable for allocations against the higher
       zone.  So we do want to san all the relevant zones at an equal rate.
    9ef935c2
vmscan.c 29.9 KB