[PATCH v7 2/3] sched/rt: Init 'back' in init_tg_rt_entry

From: Yajun Deng
Date: Mon Oct 09 2023 - 08:23:29 EST


The member 'back' in struct sched_rt_entity only related to
CONFIG_RT_GROUP_SCHED, so there is no need to init it in dequeue_rt_stack.

Init the member 'back' in init_tg_rt_entry.

Signed-off-by: Yajun Deng <yajun.deng@xxxxxxxxx>
---
v7: Init 'back' in init_tg_rt_entry.
v6: Independent patch.
v5: Resend it.
v4: Missed rt_se = root in dequeue_rt_stack().
v3: Keep parent is NULL in init_tg_rt_entry().
v2: Add WARN_ON_ONCE in init_tg_rt_entry().
v1: https://lore.kernel.org/all/20230801062714.3424299-1-yajun.deng@xxxxxxxxx/
---
kernel/sched/rt.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 642edbd24ffb..0d9e83c6fb71 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -233,8 +233,10 @@ void init_tg_rt_entry(struct task_group *tg, struct rt_rq *rt_rq,

if (!parent)
rt_se->rt_rq = &rq->rt;
- else
+ else {
rt_se->rt_rq = parent->my_q;
+ parent->back = rt_se;
+ }

rt_se->my_q = rt_rq;
rt_se->parent = parent;
@@ -1444,10 +1446,8 @@ static void dequeue_rt_stack(struct sched_rt_entity *rt_se, unsigned int flags)
struct sched_rt_entity *back = NULL;
unsigned int rt_nr_running;

- for_each_sched_rt_entity(rt_se) {
- rt_se->back = back;
+ for_each_sched_rt_entity(rt_se)
back = rt_se;
- }

rt_nr_running = rt_rq_of_se(back)->rt_nr_running;

--
2.25.1