• Andrew Morton's avatar
    [PATCH] low-latency page reclaim · 407ee6c8
    Andrew Morton authored
    Convert the VM to not wait on other people's dirty data.
    
     - If we find a dirty page and its queue is not congested, do some writeback.
    
     - If we find a dirty page and its queue _is_ congested then just
       refile the page.
    
     - If we find a PageWriteback page then just refile the page.
    
     - There is additional throttling for write(2) callers.  Within
       generic_file_write(), record their backing queue in ->current.
       Within page reclaim, if this tasks encounters a page which is dirty
       or under writeback onthis queue, block on it.  This gives some more
       writer throttling and reduces the page refiling frequency.
    
    It's somewhat CPU expensive - under really heavy load we only get a 50%
    reclaim rate in pages coming off the tail of the LRU.  This can be
    fixed by splitting the inactive list into reclaimable and
    non-reclaimable lists.  But the CPU load isn't too bad, and latency is
    much, much more important in these situations.
    
    Example: with `mem=512m', running 4 instances of `dbench 100', 2.5.34
    took 35 minutes to compile a kernel.  With this patch, it took three
    minutes, 45 seconds.
    
    I haven't done swapcache or MAP_SHARED pages yet.  If there's tons of
    dirty swapcache or mmap data around we still stall heavily in page
    reclaim.  That's less important.
    
    This patch also has a tweak for swapless machines: don't even bother
    bringing anon pages onto the inactive list if there is no swap online.
    407ee6c8
swapfile.c 35.4 KB