Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 310470
b: refs/heads/master
c: b654f7d
h: refs/heads/master
v: v3
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed May 30, 2012
1 parent dd1d2e1 commit 88a69dd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 74a5ce20e6eeeb3751340b390e7ac1d1d07bbf55
refs/heads/master: b654f7de41b0e3903ee2b51d3b8db77fe52ce728
15 changes: 11 additions & 4 deletions trunk/kernel/sched/fair.c
Original file line number Diff line number Diff line change
Expand Up @@ -3503,15 +3503,22 @@ unsigned long __weak arch_scale_smt_power(struct sched_domain *sd, int cpu)
unsigned long scale_rt_power(int cpu)
{
struct rq *rq = cpu_rq(cpu);
u64 total, available;
u64 total, available, age_stamp, avg;

total = sched_avg_period() + (rq->clock - rq->age_stamp);
/*
* Since we're reading these variables without serialization make sure
* we read them once before doing sanity checks on them.
*/
age_stamp = ACCESS_ONCE(rq->age_stamp);
avg = ACCESS_ONCE(rq->rt_avg);

total = sched_avg_period() + (rq->clock - age_stamp);

if (unlikely(total < rq->rt_avg)) {
if (unlikely(total < avg)) {
/* Ensures that power won't end up being negative */
available = 0;
} else {
available = total - rq->rt_avg;
available = total - avg;
}

if (unlikely((s64)total < SCHED_POWER_SCALE))
Expand Down

0 comments on commit 88a69dd

Please sign in to comment.