Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1369328

[PATCH] sched/clock: Remove pointless test in cpu_clock/local_clock

From Daniel Lezcano <daniel.lezcano@linaro.org>
Newsgroups linux.kernel
Subject [PATCH] sched/clock: Remove pointless test in cpu_clock/local_clock
Date 2016-04-01 15:50 +0200
Message-ID <rj7Cx-53r-1@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


In case the HAVE_UNSTABLE_SCHED_CLOCK config is set, the cpu_clock() version
checks if sched_clock_stable() is not set and calls sched_clock_cpu(),
otherwise it calls sched_clock().

sched_clock_cpu() checks also if sched_clock_stable() is set and, if true,
calls sched_clock().

sched_clock() will be called in sched_clock_cpu() if sched_clock_stable() is
true.

Remove the duplicate test by directly calling sched_clock_cpu() and let the
static key act in this function instead. We can assume gcc is smart enough to
inline cpu_clock()/local_clock() to sched_clock_cpu().

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 kernel/sched/clock.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/kernel/sched/clock.c b/kernel/sched/clock.c
index fedb967..30c4b20 100644
--- a/kernel/sched/clock.c
+++ b/kernel/sched/clock.c
@@ -375,10 +375,7 @@ EXPORT_SYMBOL_GPL(sched_clock_idle_wakeup_event);
  */
 u64 cpu_clock(int cpu)
 {
-	if (!sched_clock_stable())
-		return sched_clock_cpu(cpu);
-
-	return sched_clock();
+	return sched_clock_cpu(cpu);
 }
 
 /*
@@ -390,10 +387,7 @@ u64 cpu_clock(int cpu)
  */
 u64 local_clock(void)
 {
-	if (!sched_clock_stable())
-		return sched_clock_cpu(raw_smp_processor_id());
-
-	return sched_clock();
+	return sched_clock_cpu(raw_smp_processor_id());
 }
 
 #else /* CONFIG_HAVE_UNSTABLE_SCHED_CLOCK */
-- 
1.9.1

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] sched/clock: Remove pointless test in cpu_clock/local_clock Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-04-01 15:50 +0200
  Re: [PATCH] sched/clock: Remove pointless test in  cpu_clock/local_clock Peter Zijlstra <peterz@infradead.org> - 2016-04-01 17:20 +0200
    Re: [PATCH] sched/clock: Remove pointless test in  cpu_clock/local_clock Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-04-01 20:00 +0200

csiph-web