diff mbox

[29/51] writeback, blkcg: propagate non-root blkcg congestion state

Message ID 1432329245-5844-30-git-send-email-tj@kernel.org (mailing list archive)
State New, archived
Headers show

Commit Message

Tejun Heo May 22, 2015, 9:13 p.m. UTC
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 <tj@kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Jan Kara <jack@suse.cz>
Cc: Vivek Goyal <vgoyal@redhat.com>
---
 block/blk-core.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

Comments

Jan Kara June 30, 2015, 3:03 p.m. UTC | #1
On Fri 22-05-15 17:13:43, Tejun Heo wrote:
> 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.

Looks good. You can add:

Reviewed-by: Jan Kara <jack@suse.com>

								Honza

> 
> Signed-off-by: Tejun Heo <tj@kernel.org>
> Cc: Jens Axboe <axboe@kernel.dk>
> Cc: Jan Kara <jack@suse.cz>
> Cc: Vivek Goyal <vgoyal@redhat.com>
> ---
>  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 b457c4f..cf6974e 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_congested, sync);
>  #else
> -	clear_wb_congested(rl->q->backing_dev_info.wb.congested, 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.congested, 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_congested, sync);
>  #else
> -	set_wb_congested(rl->q->backing_dev_info.wb.congested, sync);
> +	/* see blk_clear_congested() */
> +	if (rl == &rl->q->root_rl)
> +		set_wb_congested(rl->q->backing_dev_info.wb.congested, sync);
>  #endif
>  }
>  
> -- 
> 2.4.0
>
diff mbox

Patch

diff --git a/block/blk-core.c b/block/blk-core.c
index b457c4f..cf6974e 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_congested, sync);
 #else
-	clear_wb_congested(rl->q->backing_dev_info.wb.congested, 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.congested, 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_congested, sync);
 #else
-	set_wb_congested(rl->q->backing_dev_info.wb.congested, sync);
+	/* see blk_clear_congested() */
+	if (rl == &rl->q->root_rl)
+		set_wb_congested(rl->q->backing_dev_info.wb.congested, sync);
 #endif
 }