[PATCH] sched/fair: code clean up for __sched_period()
From: Boqun Feng
Date: Thu Jul 02 2015 - 10:27:55 EST
Since commit: 4bf0b77158 ("sched: remove do_div() from
__sched_slice()"), the logic of __sched_period() can be implemented as a
single if-else without any local variable, so this patch cleans it up
with an if-else statement, which expresses the function's logic
straightforwardly.
Signed-off-by: Boqun Feng <boqun.feng@xxxxxxxxx>
---
kernel/sched/fair.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 4b6e5f6..341a51f 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -616,15 +616,10 @@ static inline u64 calc_delta_fair(u64 delta, struct sched_entity *se)
*/
static u64 __sched_period(unsigned long nr_running)
{
- u64 period = sysctl_sched_latency;
- unsigned long nr_latency = sched_nr_latency;
-
- if (unlikely(nr_running > nr_latency)) {
- period = sysctl_sched_min_granularity;
- period *= nr_running;
- }
-
- return period;
+ if (unlikely(nr_running > sched_nr_latency))
+ return nr_running * sysctl_sched_min_granularity;
+ else
+ return sysctl_sched_latency;
}
/*
--
2.4.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/