public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Yu Kuai <yukuai3@huawei.com>
Cc: jack@suse.cz, paolo.valente@linaro.org, axboe@kernel.dk,
	tj@kernel.org, linux-block@vger.kernel.org,
	cgroups@vger.kernel.org, linux-kernel@vger.kernel.org,
	yi.zhang@huawei.com
Subject: Re: [PATCH -next v5 1/3] block, bfq: record how many queues are busy in bfq_group
Date: Thu, 28 Apr 2022 14:45:37 +0200	[thread overview]
Message-ID: <20220428124537.c5ve4vs2jk5uzthy@quack3.lan> (raw)
In-Reply-To: <20220428120837.3737765-2-yukuai3@huawei.com>

On Thu 28-04-22 20:08:35, Yu Kuai wrote:
> Prepare to refactor the counting of 'num_groups_with_pending_reqs'.
> 
> Add a counter 'busy_queues' in bfq_group, and update it in
> bfq_add/del_bfqq_busy().
> 
> Signed-off-by: Yu Kuai <yukuai3@huawei.com>

Looks good. Feel free to add:

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

								Honza

> ---
>  block/bfq-cgroup.c  |  1 +
>  block/bfq-iosched.h |  2 ++
>  block/bfq-wf2q.c    | 20 ++++++++++++++++++++
>  3 files changed, 23 insertions(+)
> 
> diff --git a/block/bfq-cgroup.c b/block/bfq-cgroup.c
> index 09574af83566..4d516879d9fa 100644
> --- a/block/bfq-cgroup.c
> +++ b/block/bfq-cgroup.c
> @@ -557,6 +557,7 @@ static void bfq_pd_init(struct blkg_policy_data *pd)
>  				   */
>  	bfqg->bfqd = bfqd;
>  	bfqg->active_entities = 0;
> +	bfqg->busy_queues = 0;
>  	bfqg->online = true;
>  	bfqg->rq_pos_tree = RB_ROOT;
>  }
> diff --git a/block/bfq-iosched.h b/block/bfq-iosched.h
> index 978ef5d6fe6a..3847f4ab77ac 100644
> --- a/block/bfq-iosched.h
> +++ b/block/bfq-iosched.h
> @@ -906,6 +906,7 @@ struct bfq_group_data {
>   *                   are groups with more than one active @bfq_entity
>   *                   (see the comments to the function
>   *                   bfq_bfqq_may_idle()).
> + * @busy_queues: number of busy bfqqs.
>   * @rq_pos_tree: rbtree sorted by next_request position, used when
>   *               determining if two or more queues have interleaving
>   *               requests (see bfq_find_close_cooperator()).
> @@ -942,6 +943,7 @@ struct bfq_group {
>  	struct bfq_entity *my_entity;
>  
>  	int active_entities;
> +	int busy_queues;
>  
>  	struct rb_root rq_pos_tree;
>  
> diff --git a/block/bfq-wf2q.c b/block/bfq-wf2q.c
> index f8eb340381cf..d9ff33e0be38 100644
> --- a/block/bfq-wf2q.c
> +++ b/block/bfq-wf2q.c
> @@ -218,6 +218,16 @@ static bool bfq_no_longer_next_in_service(struct bfq_entity *entity)
>  	return false;
>  }
>  
> +static void bfq_inc_busy_queues(struct bfq_queue *bfqq)
> +{
> +	bfqq_group(bfqq)->busy_queues++;
> +}
> +
> +static void bfq_dec_busy_queues(struct bfq_queue *bfqq)
> +{
> +	bfqq_group(bfqq)->busy_queues--;
> +}
> +
>  #else /* CONFIG_BFQ_GROUP_IOSCHED */
>  
>  static bool bfq_update_parent_budget(struct bfq_entity *next_in_service)
> @@ -230,6 +240,14 @@ static bool bfq_no_longer_next_in_service(struct bfq_entity *entity)
>  	return true;
>  }
>  
> +static void bfq_inc_busy_queues(struct bfq_queue *bfqq)
> +{
> +}
> +
> +static void bfq_dec_busy_queues(struct bfq_queue *bfqq)
> +{
> +}
> +
>  #endif /* CONFIG_BFQ_GROUP_IOSCHED */
>  
>  /*
> @@ -1660,6 +1678,7 @@ void bfq_del_bfqq_busy(struct bfq_data *bfqd, struct bfq_queue *bfqq,
>  	bfq_clear_bfqq_busy(bfqq);
>  
>  	bfqd->busy_queues[bfqq->ioprio_class - 1]--;
> +	bfq_inc_busy_queues(bfqq);
>  
>  	if (bfqq->wr_coeff > 1)
>  		bfqd->wr_busy_queues--;
> @@ -1683,6 +1702,7 @@ void bfq_add_bfqq_busy(struct bfq_data *bfqd, struct bfq_queue *bfqq)
>  
>  	bfq_mark_bfqq_busy(bfqq);
>  	bfqd->busy_queues[bfqq->ioprio_class - 1]++;
> +	bfq_dec_busy_queues(bfqq);
>  
>  	if (!bfqq->dispatched)
>  		if (bfqq->wr_coeff == 1)
> -- 
> 2.31.1
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

  reply	other threads:[~2022-04-28 12:45 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-28 12:08 [PATCH -next v5 0/3] support concurrent sync io for bfq on a specail occasion Yu Kuai
2022-04-28 12:08 ` [PATCH -next v5 1/3] block, bfq: record how many queues are busy in bfq_group Yu Kuai
2022-04-28 12:45   ` Jan Kara [this message]
2022-04-28 12:08 ` [PATCH -next v5 2/3] block, bfq: refactor the counting of 'num_groups_with_pending_reqs' Yu Kuai
2022-04-28 12:08 ` [PATCH -next v5 3/3] block, bfq: do not idle if only one group is activated Yu Kuai
2022-05-05  1:00 ` [PATCH -next v5 0/3] support concurrent sync io for bfq on a specail occasion yukuai (C)
2022-05-14  9:29   ` yukuai (C)
2022-05-21  7:22     ` yukuai (C)
2022-05-21 12:21       ` Jens Axboe
2022-05-23  1:10         ` yukuai (C)
2022-05-23  1:24           ` Jens Axboe
2022-05-23  8:18             ` Yu Kuai
2022-05-23 12:36               ` Jens Axboe
2022-05-23 12:58                 ` Yu Kuai
2022-05-23 13:29                   ` Jens Axboe
2022-05-23  8:59           ` Jan Kara
2022-05-23 12:36             ` Jens Axboe
2022-05-23 15:25               ` Jan Kara
2022-05-24  1:13                 ` Yu Kuai
2022-06-01  6:16                   ` Jens Axboe
2022-06-01  7:19                     ` Yu Kuai
2022-06-07  3:10                 ` Yu Kuai
2022-06-07  9:54                   ` Jan Kara
2022-06-07 11:51                     ` Yu Kuai
2022-06-07 13:06                       ` Yu Kuai
2022-06-07 20:30                         ` Jan Kara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220428124537.c5ve4vs2jk5uzthy@quack3.lan \
    --to=jack@suse.cz \
    --cc=axboe@kernel.dk \
    --cc=cgroups@vger.kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paolo.valente@linaro.org \
    --cc=tj@kernel.org \
    --cc=yi.zhang@huawei.com \
    --cc=yukuai3@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox