linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Valente <paolo.valente@linaro.org>
To: Yu Kuai <yukuai3@huawei.com>
Cc: Jan Kara <jack@suse.cz>, Tejun Heo <tj@kernel.org>,
	Jens Axboe <axboe@kernel.dk>,
	cgroups@vger.kernel.org,
	linux-block <linux-block@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	yi.zhang@huawei.com
Subject: Re: [PATCH -next v6 1/3] block, bfq: record how many queues are busy in bfq_group
Date: Sat, 28 May 2022 10:18:11 +0200	[thread overview]
Message-ID: <8D29A46A-4B8A-4F05-BCE3-D9D0F0D2DD5A@linaro.org> (raw)
In-Reply-To: <20220523131818.2798712-2-yukuai3@huawei.com>



> Il giorno 23 mag 2022, alle ore 15:18, Yu Kuai <yukuai3@huawei.com> ha scritto:
> 
> 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>
> Reviewed-by: Jan Kara <jack@suse.cz>
> ---
> 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);
> 

Why do you increment the number of busy queues for the group on a
del_bfqq_busy, instead of an add_bfqq_busy?

Besides, the name of the function bfq_inc_busy_queues does not mention
the target of the update, namely the group.  This creates a little
confusion at a first sight, as one sees this function invoked right
after the update of a field with the same name: bfqd->busy_queues.

> 	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);

Same pair of comments as above.

Thanks,
Paolo

> 
> 	if (!bfqq->dispatched)
> 		if (bfqq->wr_coeff == 1)
> -- 
> 2.31.1
> 


  reply	other threads:[~2022-05-28  8:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-23 13:18 [PATCH -next v6 0/3] support concurrent sync io for bfq on a specail occasion Yu Kuai
2022-05-23 13:18 ` [PATCH -next v6 1/3] block, bfq: record how many queues are busy in bfq_group Yu Kuai
2022-05-28  8:18   ` Paolo Valente [this message]
2022-05-28  8:37     ` Yu Kuai
2022-05-23 13:18 ` [PATCH -next v6 2/3] block, bfq: refactor the counting of 'num_groups_with_pending_reqs' Yu Kuai
2022-05-28  8:27   ` Paolo Valente
2022-05-28  8:39     ` Yu Kuai
2022-05-28  8:41       ` Paolo Valente
2022-05-23 13:18 ` [PATCH -next v6 3/3] block, bfq: do not idle if only one group is activated Yu Kuai
2022-05-28  8:30   ` Paolo Valente
2022-05-28  8:18 ` [PATCH -next v6 0/3] support concurrent sync io for bfq on a specail occasion Paolo Valente

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=8D29A46A-4B8A-4F05-BCE3-D9D0F0D2DD5A@linaro.org \
    --to=paolo.valente@linaro.org \
    --cc=axboe@kernel.dk \
    --cc=cgroups@vger.kernel.org \
    --cc=jack@suse.cz \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).