summaryrefslogtreecommitdiff
path: root/mm/page-writeback.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2015-05-22 17:13:46 -0400
committerJens Axboe <axboe@fb.com>2015-06-02 08:33:35 -0600
commit766a9d6e60578f1ef6de71f89f022084f8bffc82 (patch)
treec14261a70cdc790ffca5e82fa006fa8adf663319 /mm/page-writeback.c
parentd6c10f1fc8626dc55946f4768ae322b4c57b07dd (diff)
writeback: implement backing_dev_info->tot_write_bandwidth
cgroup writeback support needs to keep track of the sum of avg_write_bandwidth of all wb's (bdi_writeback's) with dirty inodes to distribute write workload. This patch adds bdi->tot_write_bandwidth and updates inode_wb_list_move_locked(), inode_wb_list_del_locked() and wb_update_write_bandwidth() to adjust it as wb's gain and lose dirty inodes and its avg_write_bandwidth gets updated. As the update events are not synchronized with each other, bdi->tot_write_bandwidth is an atomic_long_t. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Jens Axboe <axboe@kernel.dk> Cc: Jan Kara <jack@suse.cz> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'mm/page-writeback.c')
-rw-r--r--mm/page-writeback.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index e31dea94d116..c95eb24dd652 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -881,6 +881,9 @@ static void wb_update_write_bandwidth(struct bdi_writeback *wb,
avg += (old - avg) >> 3;
out:
+ if (wb_has_dirty_io(wb))
+ atomic_long_add(avg - wb->avg_write_bandwidth,
+ &wb->bdi->tot_write_bandwidth);
wb->write_bandwidth = bw;
wb->avg_write_bandwidth = avg;
}