writeback: add dirty_throttle_control->pos_ratio
authorTejun Heo <tj@kernel.org>
Fri, 22 May 2015 22:23:26 +0000 (18:23 -0400)
committerJens Axboe <axboe@fb.com>
Tue, 2 Jun 2015 14:38:13 +0000 (08:38 -0600)
commitdaddfa3cb30ebfe322d50af146d830fd435ddb1f
tree4b67764441edb8e62798565e314759ce048218dd
parentb1cbc6d40c85639d405fee37c7bb688c3bf468d6
writeback: add dirty_throttle_control->pos_ratio

wb_position_ratio() is used to calculate pos_ratio, which is used for
two purposes.  wb_update_dirty_ratelimit() uses it to adjust
wb->[balanced_]dirty_ratelimit gradually and balance_dirty_pages() to
immediately adjust dirty_ratelimit right before applying it to
determine pause duration.

While wb_update_dirty_ratelimit() is separately rate limited from
balance_dirty_pages(), on the run where the ratelimit is updated, we
end up calculating pos_ratio twice with the same parameters.

This patch adds dirty_throttle_control->pos_ratio.
balance_dirty_pages() calculates it once per run and
wb_update_dirty_ratelimit() uses the value stored in
dirty_throttle_control.

This removes the duplicate calculation and also will help implementing
memcg wb_domain.

Signed-off-by: Tejun 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: Jens Axboe <axboe@fb.com>
mm/page-writeback.c