Skip to content

Commit 482cf79

Browse files
htejunaxboe
authored andcommitted
writeback, blkcg: propagate non-root blkcg congestion state
Now that bdi layer can handle per-blkcg bdi_writeback_congested 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. v2: Updated for bdi_writeback_congested. Signed-off-by: Tejun Heo <[email protected]> Cc: Jens Axboe <[email protected]> Cc: Jan Kara <[email protected]> Cc: Vivek Goyal <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent d40f75a commit 482cf79

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

block/blk-core.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,23 +65,26 @@ static struct workqueue_struct *kblockd_workqueue;
6565

6666
static void blk_clear_congested(struct request_list *rl, int sync)
6767
{
68-
if (rl != &rl->q->root_rl)
69-
return;
7068
#ifdef CONFIG_CGROUP_WRITEBACK
7169
clear_wb_congested(rl->blkg->wb_congested, sync);
7270
#else
73-
clear_wb_congested(rl->q->backing_dev_info.wb.congested, sync);
71+
/*
72+
* If !CGROUP_WRITEBACK, all blkg's map to bdi->wb and we shouldn't
73+
* flip its congestion state for events on other blkcgs.
74+
*/
75+
if (rl == &rl->q->root_rl)
76+
clear_wb_congested(rl->q->backing_dev_info.wb.congested, sync);
7477
#endif
7578
}
7679

7780
static void blk_set_congested(struct request_list *rl, int sync)
7881
{
79-
if (rl != &rl->q->root_rl)
80-
return;
8182
#ifdef CONFIG_CGROUP_WRITEBACK
8283
set_wb_congested(rl->blkg->wb_congested, sync);
8384
#else
84-
set_wb_congested(rl->q->backing_dev_info.wb.congested, sync);
85+
/* see blk_clear_congested() */
86+
if (rl == &rl->q->root_rl)
87+
set_wb_congested(rl->q->backing_dev_info.wb.congested, sync);
8588
#endif
8689
}
8790

0 commit comments

Comments
 (0)