• Andrew Morton's avatar
    [PATCH] writeback tuning · acb5f6f9
    Andrew Morton authored
    Tune up the VM-based writeback a bit.
    
    - Always use the multipage clustered-writeback function from within
      shrink_cache(), even if the page's mapping has a NULL ->vm_writeback().  So
      clustered writeback is turned on for all address_spaces, not just ext2.
    
      Subtle effect of this change: it is now the case that *all* writeback
      proceeds along the mapping->dirty_pages list.  The orderedness of the page
      LRUs no longer has an impact on disk scheduling.  So we only have one list
      to keep well-sorted rather than two, and churning pages around on the LRU
      will no longer damage write bandwidth - it's all up to the filesystem.
    
    - Decrease the clustered writeback from 1024 pages(!) to 32 pages.
    
      (1024 was a leftover from when this code was always dispatching writeback
      to a pdflush thread).
    
    - Fix wakeup_bdflush() so that it actually does write something (duh).
    
      do_wp_page() needs to call balance_dirty_pages_ratelimited(), so we
      throttle mmap page-dirtiers in the same way as write(2) page-dirtiers.
      This may make wakeup_bdflush() obsolete, but it doesn't hurt.
    
    - Converts generic_vm_writeback() to directly call ->writeback_mapping(),
      rather that going through writeback_single_inode().  This prevents memory
      allocators from blocking on the inode's I_LOCK.  But it does mean that two
      processes can be writing pages from the same mapping at the same time.  If
      filesystems care about this (for layout reasons) then they should serialise
      in their ->writeback_mapping a_op.
    
      This means that memory-allocators will writeback only pages, not pages
      and inodes.  There are no locks in that writeback path (except for request
      queue exhaustion).  Reduces memory allocation latency.
    
    - Implement new background_writeback function, which when kicked off
      will perform writeback until dirty memory falls below the background
      threshold.
    
    - Put written-back pages onto the remote end of the page LRU.  It
      does this in the slow-and-stupid way at present.  pagemap_lru_lock
      stress-relief is planned...
    
    - Remove the funny writeback_unused_inodes() stuff from prune_icache().
      Writeback from wakeup_bdflush() and the `kupdate' function now just
      naturally cleanses the oldest inodes so we don't need to do anything
      there.
    
    - Dirty memory balancing is still using magic numbers: "after you
      dirtied your 1,000th page, go write 1,500".  Obviously, this needs
      more work.
    acb5f6f9
vmscan.c 19.7 KB