[PATCH 11/45] writeback, blkcg: propagate non-root blkcg congestion state

From: Tejun Heo
Date: Tue Jan 06 2015 - 16:38:49 EST


Now that bdi layer can handle per cgwb (cgroup bdi_writeback)
congestion state, blk_{set|clear}_congested() can propagate non-root
blkcg congestion state to them.

This can be easily achieved by disabling the root_rl tests in
blk_{set|clear}_congested(). Note that we still need those tests when
!CONFIG_CGROUP_WRITEBACK as otherwise we'll end up flipping root blkcg
wb's congestion state for events happening on other blkcgs.

Signed-off-by: Tejun Heo <tj@xxxxxxxxxx>
Cc: Jens Axboe <axboe@xxxxxxxxx>
Cc: Jan Kara <jack@xxxxxxx>
Cc: Vivek Goyal <vgoyal@xxxxxxxxxx>
---
block/blk-core.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index c9a7d6c..d731f1a 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -65,23 +65,26 @@ static struct workqueue_struct *kblockd_workqueue;

static void blk_clear_congested(struct request_list *rl, int sync)
{
- if (rl != &rl->q->root_rl)
- return;
#ifdef CONFIG_CGROUP_WRITEBACK
clear_wb_congested(rl->blkg->wb, sync);
#else
- clear_wb_congested(&rl->q->backing_dev_info.wb, sync);
+ /*
+ * If !CGROUP_WRITEBACK, all blkg's map to bdi->wb and we shouldn't
+ * flip its congestion state for events on other blkcgs.
+ */
+ if (rl == &rl->q->root_rl)
+ clear_wb_congested(&rl->q->backing_dev_info.wb, sync);
#endif
}

static void blk_set_congested(struct request_list *rl, int sync)
{
- if (rl != &rl->q->root_rl)
- return;
#ifdef CONFIG_CGROUP_WRITEBACK
set_wb_congested(rl->blkg->wb, sync);
#else
- set_wb_congested(&rl->q->backing_dev_info.wb, sync);
+ /* see blk_clear_congested() */
+ if (rl == &rl->q->root_rl)
+ set_wb_congested(&rl->q->backing_dev_info.wb, sync);
#endif
}

--
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/