projects
/
GitHub
/
exynos8895
/
android_kernel_samsung_universal8895.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a1d9a32
)
sched: Make scale_rt_power() deal with backward clocks
author
Peter Zijlstra
<peterz@infradead.org>
Thu, 27 Feb 2014 09:40:35 +0000
(10:40 +0100)
committer
Ingo Molnar
<mingo@kernel.org>
Fri, 18 Apr 2014 10:07:21 +0000
(12:07 +0200)
Mike reported that, while unlikely, its entirely possible for
scale_rt_power() to see the time go backwards. This yields rather
'interesting' results.
So like all other sites that deal with clocks; make this one ignore
backward clock movement too.
Reported-by: Mike Galbraith <bitbucket@online.de>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link:
http://lkml.kernel.org/r/20140227094035.GZ9987@twins.programming.kicks-ass.net
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
kernel/sched/fair.c
patch
|
blob
|
blame
|
history
diff --git
a/kernel/sched/fair.c
b/kernel/sched/fair.c
index 7570dd969c2838e9aab12ba9cb2c24cb87e21855..5e157f157d85b3fba115f078e9d89b748c5a0d7d 100644
(file)
--- a/
kernel/sched/fair.c
+++ b/
kernel/sched/fair.c
@@
-5564,6
+5564,7
@@
static unsigned long scale_rt_power(int cpu)
{
struct rq *rq = cpu_rq(cpu);
u64 total, available, age_stamp, avg;
+ s64 delta;
/*
* Since we're reading these variables without serialization make sure
@@
-5572,7
+5573,11
@@
static unsigned long scale_rt_power(int cpu)
age_stamp = ACCESS_ONCE(rq->age_stamp);
avg = ACCESS_ONCE(rq->rt_avg);
- total = sched_avg_period() + (rq_clock(rq) - age_stamp);
+ delta = rq_clock(rq) - age_stamp;
+ if (unlikely(delta < 0))
+ delta = 0;
+
+ total = sched_avg_period() + delta;
if (unlikely(total < avg)) {
/* Ensures that power won't end up being negative */