lkml.org 
[lkml]   [2021]   [Nov]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH RFC 4/9] block, bfq: count root group into 'num_groups_with_pending_reqs'
Date
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, It's okay with previous patches handle the case that
for_each_entity() access root group.

Signed-off-by: Yu Kuai <yukuai3@huawei.com>
---
block/bfq-cgroup.c | 2 +-
block/bfq-iosched.h | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/block/bfq-cgroup.c b/block/bfq-cgroup.c
index 24a5c5329bcd..9c36deda4ed4 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;
}

diff --git a/block/bfq-iosched.h b/block/bfq-iosched.h
index ef875b8046e5..515eb2604a37 100644
--- a/block/bfq-iosched.h
+++ b/block/bfq-iosched.h
@@ -1021,13 +1021,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)

--
2.31.1
\
 
 \ /
  Last update: 2021-11-27 11:02    [W:0.109 / U:1.940 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site