sched/fair: Clean up the __sched_period() code
authorBoqun Feng <boqun.feng@gmail.com>
Thu, 2 Jul 2015 14:25:52 +0000 (22:25 +0800)
committerIngo Molnar <mingo@kernel.org>
Tue, 7 Jul 2015 06:46:10 +0000 (08:46 +0200)
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 variables, 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@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1435847152-29543-1-git-send-email-boqun.feng@gmail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
kernel/sched/fair.c

index a53a610095e63da814298114daf03e56631c19e7..03ea05bd4c13866f518b41ab8a544320d67ab89d 100644 (file)
@@ -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;
 }
 
 /*
This page took 0.028819 seconds and 5 git commands to generate.