summaryrefslogtreecommitdiff
path: root/arch/arm/kernel
diff options
context:
space:
mode:
authorStephen Boyd <sboyd@codeaurora.org>2013-06-01 23:39:39 -0700
committerAjay Nandakumar <anandakumarm@nvidia.com>2014-01-13 12:03:36 +0530
commit8ec79f015299aafb8e44095545a4e2656e6992c9 (patch)
tree62e40e20c942123502d81003adecaca80bd0a28a /arch/arm/kernel
parent72b1f2b888b38fd61cf71e2437f70e57ba4b09b5 (diff)
ARM: sched_clock: Return suspended count earlier
If we're suspended and sched_clock() is called we're going to read the hardware one more time and throw away that value and return back the cached value we saved during the suspend callback. This is wasteful. Let's short circuit all that and return the cached value as early as possible if we're suspended. Bug 1399318 Acked-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: John Stultz <john.stultz@linaro.org> (cherry picked from commit ffbfb5e316f0db486798ccf1db36a577ffe79637) Signed-off-by: Ajay Nandakumar <anandakumarm@nvidia.com> Change-Id: I618d4d0c03b8ff5e5da47940fc5cfa66bc5145b1
Diffstat (limited to 'arch/arm/kernel')
-rw-r--r--arch/arm/kernel/sched_clock.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/arch/arm/kernel/sched_clock.c b/arch/arm/kernel/sched_clock.c
index 45efe86e8b08..a781c59b93c0 100644
--- a/arch/arm/kernel/sched_clock.c
+++ b/arch/arm/kernel/sched_clock.c
@@ -55,9 +55,6 @@ static unsigned long long notrace cyc_to_sched_clock(u32 cyc, u32 mask)
u64 epoch_ns;
u32 epoch_cyc;
- if (cd.suspended)
- return cd.epoch_ns;
-
/*
* Load the epoch_cyc and epoch_ns atomically. We do this by
* ensuring that we always write epoch_cyc, epoch_ns and
@@ -174,6 +171,9 @@ unsigned long long __read_mostly (*sched_clock_func)(void) = sched_clock_32;
unsigned long long notrace sched_clock(void)
{
+ if (cd.suspended)
+ return cd.epoch_ns;
+
return sched_clock_func();
}