public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sched/fair: code clean up for __sched_period()
@ 2015-07-02 14:25 Boqun Feng
  2015-07-06 12:41 ` Boqun Feng
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Boqun Feng @ 2015-07-02 14:25 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra; +Cc: linux-kernel, Srikar Dronamraju, Boqun Feng

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@gmail.com>
---
 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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-07-07  6:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-02 14:25 [PATCH] sched/fair: code clean up for __sched_period() Boqun Feng
2015-07-06 12:41 ` Boqun Feng
2015-07-06 12:49   ` Peter Zijlstra
2015-07-06 12:53     ` Ingo Molnar
2015-07-06 13:47       ` Boqun Feng
2015-07-06 13:37     ` Boqun Feng
2015-07-06 15:51 ` [tip:sched/core] sched/fair: Clean up the __sched_period() code tip-bot for Boqun Feng
2015-07-07  6:49 ` tip-bot for Boqun Feng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox