• Nick Piggin's avatar
    [PATCH] vm: prevent kswapd pageout priority windup · 31a9b2ac
    Nick Piggin authored
    Now that we are correctly kicking off kswapd early (before the synch
    reclaim watermark), it is really doing asynchronous pageout.  This has
    exposed a latent problem where allocators running at the same time will
    make kswapd think it is getting into trouble, and cause too much swapping
    and suboptimal behaviour.
    
    This patch changes the kswapd scanning algorithm to use the same metrics
    for measuring pageout success as the synchronous reclaim path - namely, how
    much work is required to free SWAP_CLUSTER_MAX pages.
    
    This should make things less fragile all round, and has the added benefit
    that kswapd will continue running so long as memory is low and it is
    managing to free pages, rather than going through the full priority loop,
    then giving up.  Should result in much better behaviour all round,
    especially when there are concurrent allocators.
    
    akpm: the patch was confirmed to fix up the excessive swapout which Ray Bryant
    <raybry@sgi.com> has been reporting.
    Signed-off-by: default avatarNick Piggin <nickpiggin@yahoo.com.au>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    31a9b2ac
vmscan.c 33.4 KB