Skip to content

Commit a5a25b3

Browse files
WerkovPeter Zijlstra
authored andcommitted
sched: Always initialize rt_rq's task_group
rt_rq->tg may be NULL which denotes the root task_group. Store the pointer to root_task_group directly so that callers may use rt_rq->tg homogenously. root_task_group exists always with CONFIG_CGROUPS_SCHED, CONFIG_RT_GROUP_SCHED depends on that. This changes root level rt_rq's default limit from infinity to the value of (originally) global RT throttling. Signed-off-by: Michal Koutný <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent e285313 commit a5a25b3

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

kernel/sched/rt.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ void init_rt_rq(struct rt_rq *rt_rq)
8989
rt_rq->rt_throttled = 0;
9090
rt_rq->rt_runtime = 0;
9191
raw_spin_lock_init(&rt_rq->rt_runtime_lock);
92+
rt_rq->tg = &root_task_group;
9293
#endif
9394
}
9495

@@ -482,9 +483,6 @@ static inline bool rt_task_fits_capacity(struct task_struct *p, int cpu)
482483

483484
static inline u64 sched_rt_runtime(struct rt_rq *rt_rq)
484485
{
485-
if (!rt_rq->tg)
486-
return RUNTIME_INF;
487-
488486
return rt_rq->rt_runtime;
489487
}
490488

@@ -1154,8 +1152,7 @@ inc_rt_group(struct sched_rt_entity *rt_se, struct rt_rq *rt_rq)
11541152
if (rt_se_boosted(rt_se))
11551153
rt_rq->rt_nr_boosted++;
11561154

1157-
if (rt_rq->tg)
1158-
start_rt_bandwidth(&rt_rq->tg->rt_bandwidth);
1155+
start_rt_bandwidth(&rt_rq->tg->rt_bandwidth);
11591156
}
11601157

11611158
static void

kernel/sched/sched.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -821,6 +821,8 @@ struct rt_rq {
821821
unsigned int rt_nr_boosted;
822822

823823
struct rq *rq;
824+
#endif
825+
#ifdef CONFIG_CGROUP_SCHED
824826
struct task_group *tg;
825827
#endif
826828
};

0 commit comments

Comments
 (0)