• Wu Fengguang's avatar
    writeback: control dirty pause time · 57fc978c
    Wu Fengguang authored
    
    
    The dirty pause time shall ultimately be controlled by adjusting
    nr_dirtied_pause, since there is relationship
    
    	pause = pages_dirtied / task_ratelimit
    
    Assuming
    
    	pages_dirtied ~= nr_dirtied_pause
    	task_ratelimit ~= dirty_ratelimit
    
    We get
    
    	nr_dirtied_pause ~= dirty_ratelimit * desired_pause
    
    Here dirty_ratelimit is preferred over task_ratelimit because it's
    more stable.
    
    It's also important to limit possible large transitional errors:
    
    - bw is changing quickly
    - pages_dirtied << nr_dirtied_pause on entering dirty exceeded area
    - pages_dirtied >> nr_dirtied_pause on btrfs (to be improved by a
      separate fix, but still expect non-trivial errors)
    
    So we end up using the above formula inside clamp_val().
    
    The best test case for this code is to run 100 "dd bs=4M" tasks on
    btrfs and check its pause time distribution.
    Signed-off-by: default avatarWu Fengguang <fengguang.wu@intel.com>
    57fc978c
page-writeback.c 57.7 KB