Skip to content

Commit

Permalink
sched: using dst_rq instead of this_rq during load balance
Browse files Browse the repository at this point in the history
As we already have dst_rq in lb_env, using or changing "this_rq" do not
make sense.

This patch will replace "this_rq" with dst_rq in load_balance, and we
don't need to change "this_rq" while process LBF_SOME_PINNED any more.

Signed-off-by: Michael Wang <wangyun@linux.vnet.ibm.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/501F8357.3070102@linux.vnet.ibm.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
  • Loading branch information
Michael Wang authored and Thomas Gleixner committed Aug 13, 2012
1 parent edde96e commit 78feefc
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions kernel/sched/fair.c
Original file line number Diff line number Diff line change
Expand Up @@ -4283,7 +4283,7 @@ static int load_balance(int this_cpu, struct rq *this_rq,
goto out_balanced;
}

BUG_ON(busiest == this_rq);
BUG_ON(busiest == env.dst_rq);

schedstat_add(sd, lb_imbalance[idle], env.imbalance);

Expand All @@ -4304,15 +4304,15 @@ static int load_balance(int this_cpu, struct rq *this_rq,
update_h_load(env.src_cpu);
more_balance:
local_irq_save(flags);
double_rq_lock(this_rq, busiest);
double_rq_lock(env.dst_rq, busiest);

/*
* cur_ld_moved - load moved in current iteration
* ld_moved - cumulative load moved across iterations
*/
cur_ld_moved = move_tasks(&env);
ld_moved += cur_ld_moved;
double_rq_unlock(this_rq, busiest);
double_rq_unlock(env.dst_rq, busiest);
local_irq_restore(flags);

if (env.flags & LBF_NEED_BREAK) {
Expand Down Expand Up @@ -4348,8 +4348,7 @@ static int load_balance(int this_cpu, struct rq *this_rq,
if ((env.flags & LBF_SOME_PINNED) && env.imbalance > 0 &&
lb_iterations++ < max_lb_iterations) {

this_rq = cpu_rq(env.new_dst_cpu);
env.dst_rq = this_rq;
env.dst_rq = cpu_rq(env.new_dst_cpu);
env.dst_cpu = env.new_dst_cpu;
env.flags &= ~LBF_SOME_PINNED;
env.loop = 0;
Expand Down

0 comments on commit 78feefc

Please sign in to comment.