2020-08-14 11:42:21

by Tianxianting

[permalink] [raw]
Subject: [PATCH] sched: Remove useless settings when 'tg == d->tg'

if 'tg == d->tg' is true, the previous settings for period,runtime
are unnecessary. So move the settings to the 'else' branch.

Signed-off-by: Xianting Tian <[email protected]>
---
kernel/sched/rt.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index f395ddb75..8b5505735 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -2504,12 +2504,12 @@ static int tg_rt_schedulable(struct task_group *tg, void *data)
unsigned long total, sum = 0;
u64 period, runtime;

- period = ktime_to_ns(tg->rt_bandwidth.rt_period);
- runtime = tg->rt_bandwidth.rt_runtime;
-
if (tg == d->tg) {
period = d->rt_period;
runtime = d->rt_runtime;
+ } else {
+ period = ktime_to_ns(tg->rt_bandwidth.rt_period);
+ runtime = tg->rt_bandwidth.rt_runtime;
}

/*
--
2.17.1