Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 304996
b: refs/heads/master
c: 0ce9047
h: refs/heads/master
v: v3
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed May 9, 2012
1 parent 7960bc9 commit 43def9f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 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: c22402a2f76e88b04b7a8b6c0597ad9ba6fd71de
refs/heads/master: 0ce90475dcdbe90affc218e9688c8401e468e84d
1 change: 1 addition & 0 deletions trunk/include/linux/sched.h
Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,7 @@ struct sched_group_power {
struct sched_group {
struct sched_group *next; /* Must be a circular list */
atomic_t ref;
int balance_cpu;

unsigned int group_weight;
struct sched_group_power *sgp;
Expand Down
2 changes: 2 additions & 0 deletions trunk/kernel/sched/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -6060,6 +6060,7 @@ build_overlap_sched_groups(struct sched_domain *sd, int cpu)

sg->sgp = *per_cpu_ptr(sdd->sgp, cpumask_first(sg_span));
atomic_inc(&sg->sgp->ref);
sg->balance_cpu = -1;

if (cpumask_test_cpu(cpu, sg_span))
groups = sg;
Expand Down Expand Up @@ -6135,6 +6136,7 @@ build_sched_groups(struct sched_domain *sd, int cpu)

cpumask_clear(sched_group_cpus(sg));
sg->sgp->power = 0;
sg->balance_cpu = -1;

for_each_cpu(j, span) {
if (get_group(j, sdd, NULL) != group)
Expand Down
9 changes: 7 additions & 2 deletions trunk/kernel/sched/fair.c
Original file line number Diff line number Diff line change
Expand Up @@ -3828,7 +3828,8 @@ static inline void update_sg_lb_stats(struct sched_domain *sd,
*/
if (local_group) {
if (idle != CPU_NEWLY_IDLE) {
if (balance_cpu != this_cpu) {
if (balance_cpu != this_cpu ||
cmpxchg(&group->balance_cpu, -1, balance_cpu) != -1) {
*balance = 0;
return;
}
Expand Down Expand Up @@ -4929,7 +4930,7 @@ static void rebalance_domains(int cpu, enum cpu_idle_type idle)
int balance = 1;
struct rq *rq = cpu_rq(cpu);
unsigned long interval;
struct sched_domain *sd;
struct sched_domain *sd, *last = NULL;
/* Earliest time when we have to do rebalance again */
unsigned long next_balance = jiffies + 60*HZ;
int update_next_balance = 0;
Expand All @@ -4939,6 +4940,7 @@ static void rebalance_domains(int cpu, enum cpu_idle_type idle)

rcu_read_lock();
for_each_domain(cpu, sd) {
last = sd;
if (!(sd->flags & SD_LOAD_BALANCE))
continue;

Expand Down Expand Up @@ -4983,6 +4985,9 @@ static void rebalance_domains(int cpu, enum cpu_idle_type idle)
if (!balance)
break;
}
for (sd = last; sd; sd = sd->child)
(void)cmpxchg(&sd->groups->balance_cpu, cpu, -1);

rcu_read_unlock();

/*
Expand Down

0 comments on commit 43def9f

Please sign in to comment.