• Andrew Morton's avatar
    [PATCH] multithread page reclaim · 3aa1dc77
    Andrew Morton authored
    This patch multithreads the main page reclaim function, shrink_cache().
    
    This function used to run under pagemap_lru_lock.  Instead, we grab
    that lock, put 32 pages from the LRU into a private list, drop the
    pagemap_lru_lock and then proceed to attempt to free those pages.
    
    Any pages which were succesfully reclaimed are batch-freed.  Pages
    which were not reclaimed are re-added to the LRU.
    
    This patch reduces pagemap_lru_lock contention on the 4-way by a factor
    of thirty.
    
    The shrink_cache() code has been simplified somewhat.
    
    refill_inactive() was being called too often - often just to process
    two or three pages.  Fiddled with that so it processes pages at the
    same rate, but works on 32 pages at a time.
    
    Added a couple of mark_page_accessed() calls into mm/memory.c from 2.4.
    They seem appropriate.
    
    Change the shrink_caches() logic so that it will still trickle through
    the active list (via refill_inactive) even if the inactive list is much
    larger than the active list.
    3aa1dc77
vmscan.c 17.5 KB