• Andrew Morton's avatar
    [PATCH] Move reclaimable pages to the tail ofthe inactive list on · 3b0db538
    Andrew Morton authored
    The patch addresses some search complexity failures which occur when
    there is a large amount of dirty data on the inactive list.
    
    Normally we attempt to write out those pages and then move them to the
    head of the inactive list.  But this goes against page aging, and means
    that the page has to traverse the entire list again before it can be
    reclaimed.
    
    But the VM really wants to reclaim that page - it has reached the tail
    of the LRU.
    
    So what we do in this patch is to mark the page as needing reclamation,
    and then start I/O.  In the IO completion handler we check to see if
    the page is still probably reclaimable and if so, move it to the tail of
    the inactive list, where it can be reclaimed immediately.
    
    Under really heavy swap-intensive loads this increases the page reclaim
    efficiency (pages reclaimed/pages scanned) from 10% to 25%.  Which is
    OK for that sort of load.  Not great, but OK.
    
    This code path takes the LRU lock once per page.  I didn't bother
    playing games with batching up the locking work - it's a rare code
    path, and the machine has plenty of CPU to spare when this is
    happening.
    3b0db538
filemap.c 45 KB