• Tejun Heo's avatar
    writeback: add dirty_throttle_control->wb_bg_thresh · 970fb01a
    Tejun Heo authored
    wb_bg_thresh is currently treated as a second-class citizen.  It's
    only used when BDI_CAP_STRICTLIMIT is set and balance_dirty_pages()
    doesn't calculate it unless the cap is set.  When the cap is set, the
    calculated value is not passed around but instead recalculated
    whenever it's used.
    
    wb_position_ratio() calculates it by scaling wb_thresh proportional to
    bg_thresh / thresh.  wb_update_dirty_ratelimit() uses wb_dirty_limit()
    on bg_thresh, which should generally lead to a similar result as the
    proportional scaling but can also be way off in the presence of
    max/min_ratio settings.
    
    Avoiding wb_bg_thresh calculation saves us one u64 multiplication and
    divsion when BDI_CAP_STRICTLIMIT is not set.  Given that
    balance_dirty_pages() is already ratelimited, this doesn't justify the
    incurred extra complexity.
    
    This patch adds wb_bg_thresh to dirty_throttle_control and makes
    wb_dirty_limits() always calculate it and updates the users to use the
    pre-calculated value.
    Signed-off-by: default avatarTejun Heo <tj@kernel.org>
    Cc: Jens Axboe <axboe@kernel.dk>
    Cc: Jan Kara <jack@suse.cz>
    Cc: Wu Fengguang <fengguang.wu@intel.com>
    Cc: Greg Thelen <gthelen@google.com>
    Signed-off-by: default avatarJens Axboe <axboe@fb.com>
    970fb01a
page-writeback.c 75.6 KB