Messages in this thread Patch in this message | | | From | Frederic Weisbecker <> | Subject | [PATCH 16/24] sched: Update clock of nohz busiest rq before balancing | Date | Thu, 20 Dec 2012 19:33:03 +0100 |
| |
move_tasks() and active_load_balance_cpu_stop() both need to have the busiest rq clock uptodate because they may end up calling can_migrate_task() that uses rq->clock_task to determine if the task running in the busiest runqueue is cache hot.
Hence if the busiest runqueue is tickless, update its clock before reading it.
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Cc: Alessio Igor Bogani <abogani@kernel.org> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Avi Kivity <avi@redhat.com> Cc: Chris Metcalf <cmetcalf@tilera.com> Cc: Christoph Lameter <cl@linux.com> Cc: Geoff Levand <geoff@infradead.org> Cc: Gilad Ben Yossef <gilad@benyossef.com> Cc: Hakan Akkan <hakanakkan@gmail.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Paul Gortmaker <paul.gortmaker@windriver.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Thomas Gleixner <tglx@linutronix.de> [ Forward port conflicts ] Signed-off-by: Steven Rostedt <rostedt@goodmis.org> --- kernel/sched/fair.c | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index b31f7ca..347dd3f 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -4774,6 +4774,7 @@ static int load_balance(int this_cpu, struct rq *this_rq, { int ld_moved, cur_ld_moved, active_balance = 0; int lb_iterations, max_lb_iterations; + int clock_updated; struct sched_group *group; struct rq *busiest; unsigned long flags; @@ -4817,6 +4818,7 @@ redo: ld_moved = 0; lb_iterations = 1; + clock_updated = 0; if (busiest->nr_running > 1) { /* * Attempt to move tasks. If find_busiest_group has found @@ -4840,6 +4842,14 @@ more_balance: */ cur_ld_moved = move_tasks(&env); ld_moved += cur_ld_moved; + + /* + * Move tasks may end up calling can_migrate_task() which + * requires an uptodate value of the rq clock. + */ + update_nohz_rq_clock(busiest); + clock_updated = 1; + double_rq_unlock(env.dst_rq, busiest); local_irq_restore(flags); @@ -4935,6 +4945,13 @@ more_balance: busiest->active_balance = 1; busiest->push_cpu = this_cpu; active_balance = 1; + /* + * active_load_balance_cpu_stop may end up calling + * can_migrate_task() which requires an uptodate + * value of the rq clock. + */ + if (!clock_updated) + update_nohz_rq_clock(busiest); } raw_spin_unlock_irqrestore(&busiest->lock, flags); -- 1.7.5.4
| |