lkml.org 
[lkml]   [2022]   [Apr]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH -next 05/11] block, bfq: count root group into 'num_groups_with_pending_reqs'
On Sat 05-03-22 17:11:59, Yu Kuai wrote:
> Root group is not counted into 'num_groups_with_pending_reqs' because
> 'entity->parent' is set to NULL for child entities, thus
> for_each_entity() can't access root group.
>
> This patch set root_group's entity to 'entity->parent' for child
> entities, this way root_group will be counted because for_each_entity()
> can access root_group in bfq_activate_requeue_entity(),
>
> Signed-off-by: Yu Kuai <yukuai3@huawei.com>
> ---
> block/bfq-cgroup.c | 6 +++---
> block/bfq-iosched.h | 3 ++-
> block/bfq-wf2q.c | 5 +++++
> 3 files changed, 10 insertions(+), 4 deletions(-)

I think you can remove bfqg->my_entity after this patch, can't you? Because
effectively it's only purpose was so that you don't have to special-case
children of root_group...

Honza

>
> diff --git a/block/bfq-cgroup.c b/block/bfq-cgroup.c
> index 420eda2589c0..6cd65b5e790d 100644
> --- a/block/bfq-cgroup.c
> +++ b/block/bfq-cgroup.c
> @@ -436,7 +436,7 @@ void bfq_init_entity(struct bfq_entity *entity, struct bfq_group *bfqg)
> */
> bfqg_and_blkg_get(bfqg);
> }
> - entity->parent = bfqg->my_entity; /* NULL for root group */
> + entity->parent = &bfqg->entity;
> entity->sched_data = &bfqg->sched_data;
> }
>
> @@ -581,7 +581,7 @@ static void bfq_group_set_parent(struct bfq_group *bfqg,
> struct bfq_entity *entity;
>
> entity = &bfqg->entity;
> - entity->parent = parent->my_entity;
> + entity->parent = &parent->entity;
> entity->sched_data = &parent->sched_data;
> }
>
> @@ -688,7 +688,7 @@ void bfq_bfqq_move(struct bfq_data *bfqd, struct bfq_queue *bfqq,
> else if (bfqd->last_bfqq_created == bfqq)
> bfqd->last_bfqq_created = NULL;
>
> - entity->parent = bfqg->my_entity;
> + entity->parent = &bfqg->entity;
> entity->sched_data = &bfqg->sched_data;
> /* pin down bfqg and its associated blkg */
> bfqg_and_blkg_get(bfqg);
> diff --git a/block/bfq-iosched.h b/block/bfq-iosched.h
> index ddd8eff5c272..4530ab8b42ac 100644
> --- a/block/bfq-iosched.h
> +++ b/block/bfq-iosched.h
> @@ -1024,13 +1024,14 @@ extern struct blkcg_policy blkcg_policy_bfq;
> /* - interface of the internal hierarchical B-WF2Q+ scheduler - */
>
> #ifdef CONFIG_BFQ_GROUP_IOSCHED
> -/* stop at one of the child entities of the root group */
> +/* stop at root group */
> #define for_each_entity(entity) \
> for (; entity ; entity = entity->parent)
>
> #define is_root_entity(entity) \
> (entity->sched_data == NULL)
>
> +/* stop at one of the child entities of the root group */
> #define for_each_entity_not_root(entity) \
> for (; entity && !is_root_entity(entity); entity = entity->parent)
>
> diff --git a/block/bfq-wf2q.c b/block/bfq-wf2q.c
> index 17f1d2c5b8dc..138a2950b841 100644
> --- a/block/bfq-wf2q.c
> +++ b/block/bfq-wf2q.c
> @@ -1125,6 +1125,11 @@ static void bfq_activate_requeue_entity(struct bfq_entity *entity,
> {
> for_each_entity(entity) {
> bfq_update_groups_with_pending_reqs(entity);
> +
> + /* root group is not in service tree */
> + if (is_root_entity(entity))
> + break;
> +
> __bfq_activate_requeue_entity(entity, non_blocking_wait_rq);
>
> if (!bfq_update_next_in_service(entity->sched_data, entity,
> --
> 2.31.1
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR

\
 
 \ /
  Last update: 2022-04-13 13:06    [W:0.255 / U:0.276 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site