[PATCH] sched/rt: Remove unnecessary (!rt_rq->tg) check

From: Ran Xiaokai
Date: Wed Jun 26 2019 - 21:34:07 EST


if CONFIG_RT_GROUP_SCHED is configured, every rt_rq belongs to
a certain task_group. Even top rt_rq belongs to root_task_group.
So NULL check in sched_rt_runtime() is unnecessary.

Signed-off-by: Ran Xiaokai <ran.xiaokai@xxxxxxxxxx>
---
kernel/sched/rt.c | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 1e6b909dca36..803e8b86c6f5 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -436,16 +436,13 @@ static inline int on_rt_rq(struct sched_rt_entity *rt_se)
return rt_se->on_rq;
}

-#ifdef CONFIG_RT_GROUP_SCHED
-
static inline u64 sched_rt_runtime(struct rt_rq *rt_rq)
{
- if (!rt_rq->tg)
- return RUNTIME_INF;
-
return rt_rq->rt_runtime;
}

+#ifdef CONFIG_RT_GROUP_SCHED
+
static inline u64 sched_rt_period(struct rt_rq *rt_rq)
{
return ktime_to_ns(rt_rq->tg->rt_bandwidth.rt_period);
@@ -561,11 +558,6 @@ static inline struct rt_bandwidth *sched_rt_bandwidth(struct rt_rq *rt_rq)

#else /* !CONFIG_RT_GROUP_SCHED */

-static inline u64 sched_rt_runtime(struct rt_rq *rt_rq)
-{
- return rt_rq->rt_runtime;
-}
-
static inline u64 sched_rt_period(struct rt_rq *rt_rq)
{
return ktime_to_ns(def_rt_bandwidth.rt_period);
--
2.15.2