goto out_balanced;
        }
 
-       BUG_ON(busiest == this_rq);
+       BUG_ON(busiest == env.dst_rq);
 
        schedstat_add(sd, lb_imbalance[idle], env.imbalance);
 
                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
                 */
                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) {
                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;