From: Oleksandr Natalenko <oleksandr@natalenko.name>
To: brookxu <brookxu.cn@gmail.com>
Cc: paolo.valente@linaro.org, axboe@kernel.dk,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
Piotr Gorski <lucjan.lucjanov@gmail.com>
Subject: Re: [RESEND PATCH 1/8] bfq: introduce bfq_entity_to_bfqg helper method
Date: Thu, 10 Jun 2021 10:31:47 +0200 [thread overview]
Message-ID: <20210610083147.xoefokucl5ey7v32@spock.localdomain> (raw)
In-Reply-To: <20210610072230.TAxxdh-wsL4sihK2TJxF-Gz85ZgsFR7IwOuifnxFi0k@z>
Hello.
On Thu, Jun 10, 2021 at 03:22:30PM +0800, brookxu wrote:
> From: Chunguang Xu <brookxu@tencent.com>
>
> Introduce bfq_entity_to_bfqg() to make it easier to obtain the
> bfq_group corresponding to the entity.
>
> Signed-off-by: Chunguang Xu <brookxu@tencent.com>
> ---
> block/bfq-cgroup.c | 6 ++----
> block/bfq-iosched.h | 1 +
> block/bfq-wf2q.c | 16 ++++++++++++----
> 3 files changed, 15 insertions(+), 8 deletions(-)
>
> diff --git a/block/bfq-cgroup.c b/block/bfq-cgroup.c
> index b791e20..a5f544a 100644
> --- a/block/bfq-cgroup.c
> +++ b/block/bfq-cgroup.c
> @@ -309,8 +309,7 @@ struct bfq_group *bfqq_group(struct bfq_queue *bfqq)
> {
> struct bfq_entity *group_entity = bfqq->entity.parent;
>
> - return group_entity ? container_of(group_entity, struct bfq_group,
> - entity) :
> + return group_entity ? bfq_entity_to_bfqg(group_entity) :
> bfqq->bfqd->root_group;
> }
>
> @@ -610,8 +609,7 @@ struct bfq_group *bfq_find_set_group(struct bfq_data *bfqd,
> */
> entity = &bfqg->entity;
> for_each_entity(entity) {
> - struct bfq_group *curr_bfqg = container_of(entity,
> - struct bfq_group, entity);
> + struct bfq_group *curr_bfqg = bfq_entity_to_bfqg(entity);
> if (curr_bfqg != bfqd->root_group) {
> parent = bfqg_parent(curr_bfqg);
> if (!parent)
> diff --git a/block/bfq-iosched.h b/block/bfq-iosched.h
> index b8e793c..a6f98e9 100644
> --- a/block/bfq-iosched.h
> +++ b/block/bfq-iosched.h
> @@ -941,6 +941,7 @@ struct bfq_group {
> #endif
>
> struct bfq_queue *bfq_entity_to_bfqq(struct bfq_entity *entity);
> +struct bfq_group *bfq_entity_to_bfqg(struct bfq_entity *entity);
>
> /* --------------- main algorithm interface ----------------- */
>
> diff --git a/block/bfq-wf2q.c b/block/bfq-wf2q.c
> index 070e34a..5ff0028 100644
> --- a/block/bfq-wf2q.c
> +++ b/block/bfq-wf2q.c
> @@ -149,7 +149,7 @@ struct bfq_group *bfq_bfqq_to_bfqg(struct bfq_queue *bfqq)
> if (!group_entity)
> group_entity = &bfqq->bfqd->root_group->entity;
>
> - return container_of(group_entity, struct bfq_group, entity);
> + return bfq_entity_to_bfqg(group_entity);
> }
>
> /*
> @@ -208,7 +208,7 @@ static bool bfq_no_longer_next_in_service(struct bfq_entity *entity)
> if (bfq_entity_to_bfqq(entity))
> return true;
>
> - bfqg = container_of(entity, struct bfq_group, entity);
> + bfqg = bfq_entity_to_bfqg(entity);
>
> /*
> * The field active_entities does not always contain the
> @@ -266,6 +266,15 @@ struct bfq_queue *bfq_entity_to_bfqq(struct bfq_entity *entity)
> return bfqq;
> }
>
> +struct bfq_group *bfq_entity_to_bfqg(struct bfq_entity *entity)
> +{
> + struct bfq_group *bfqg = NULL;
> +
> + if (entity->my_sched_data)
> + bfqg = container_of(entity, struct bfq_group, entity);
> +
> + return bfqg;
> +}
>
> /**
> * bfq_delta - map service into the virtual time domain.
> @@ -1001,8 +1010,7 @@ static void __bfq_activate_entity(struct bfq_entity *entity,
>
> #ifdef CONFIG_BFQ_GROUP_IOSCHED
> if (!bfq_entity_to_bfqq(entity)) { /* bfq_group */
> - struct bfq_group *bfqg =
> - container_of(entity, struct bfq_group, entity);
> + struct bfq_group *bfqg = bfq_entity_to_bfqg(entity);
> struct bfq_data *bfqd = bfqg->bfqd;
>
> if (!entity->in_groups_with_pending_reqs) {
> --
> 1.8.3.1
>
If it is a resend only, I can offer my Tested-by since I'm running this
series for quite some time already.
Thanks.
--
Oleksandr Natalenko (post-factum)
next prev parent reply other threads:[~2021-06-10 8:32 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-20 11:20 [PATCH 0/8] bfq: misc updates brookxu
2021-04-20 11:20 ` [PATCH 1/8] bfq: introduce bfq_entity_to_bfqg helper method brookxu
2021-06-10 7:22 ` [RESEND PATCH " brookxu
2021-06-10 8:31 ` Oleksandr Natalenko [this message]
2021-06-10 9:05 ` brookxu
2021-06-10 9:18 ` Piotr Górski
2021-04-20 11:20 ` [PATCH 2/8] bfq: convert the type of bfq_group.bfqd to bfq_data* brookxu
2021-06-10 7:22 ` [RESEND PATCH " brookxu
2021-04-20 11:20 ` [PATCH 3/8] bfq: limit the IO depth of CLASS_IDLE to 1 brookxu
2021-06-10 7:22 ` [RESEND PATCH " brookxu
2021-04-20 11:20 ` [PATCH 4/8] bfq: keep the minimun bandwidth for CLASS_BE brookxu
2021-06-10 7:22 ` [RESEND PATCH " brookxu
2021-04-20 11:20 ` [PATCH 5/8] bfq: remove unnecessary initialization logic brookxu
2021-06-10 7:22 ` [RESEND PATCH " brookxu
2021-04-20 11:20 ` [PATCH 6/8] bfq: optimize the calculation of bfq_weight_to_ioprio() brookxu
2021-06-10 7:22 ` [RESEND PATCH " brookxu
2021-04-20 11:20 ` [PATCH 7/8] bfq: reset entity->prio_changed in bfq_init_entity() brookxu
2021-06-10 7:22 ` [RESEND PATCH " brookxu
2021-04-20 11:20 ` [PATCH 8/8] bfq: remove unnecessary BFQ_DEFAULT_GRP_IOPRIO brookxu
2021-06-10 7:22 ` [RESEND PATCH " brookxu
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=20210610083147.xoefokucl5ey7v32@spock.localdomain \
--to=oleksandr@natalenko.name \
--cc=axboe@kernel.dk \
--cc=brookxu.cn@gmail.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lucjan.lucjanov@gmail.com \
--cc=paolo.valente@linaro.org \
/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).