Because the sched_class::put_prev_task() callback of rt and fair classes are referring to the rq clock to update their runtime statistics. A CPU running in tickless mode may carry a stale value. We need to update it there.
Signed-off-by: Frederic Weisbecker <fweis...@gmail.com> Cc: Alessio Igor Bogani <abog...@kernel.org> Cc: Andrew Morton <a...@linux-foundation.org> Cc: Chris Metcalf <cmetc...@tilera.com> Cc: Christoph Lameter <c...@linux.com> Cc: Geoff Levand <ge...@infradead.org> Cc: Gilad Ben Yossef <gi...@benyossef.com> Cc: Hakan Akkan <hakanak...@gmail.com> Cc: Ingo Molnar <mi...@kernel.org> Cc: Paul E. McKenney <paul...@linux.vnet.ibm.com> Cc: Paul Gortmaker <paul.gortma...@windriver.com> Cc: Peter Zijlstra <pet...@infradead.org> Cc: Steven Rostedt <rost...@goodmis.org> Cc: Thomas Gleixner <t...@linutronix.de> --- kernel/sched/core.c | 6 ++++++ kernel/sched/sched.h | 7 +++++++ 2 files changed, 13 insertions(+), 0 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index bfac40f..2fcbb03 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -4894,6 +4894,12 @@ static void migrate_tasks(unsigned int dead_cpu) */ rq->stop = NULL; + /* + * ->put_prev_task() need to have an up-to-date value + * of rq->clock[_task] + */ + update_nohz_rq_clock(rq); + for ( ; ; ) { /* * There's this thread running, bail when that's the only diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index fc88644..f24d91e 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -3,6 +3,7 @@ #include <linux/mutex.h> #include <linux/spinlock.h> #include <linux/stop_machine.h> +#include <linux/tick.h> #include "cpupri.h" @@ -963,6 +964,12 @@ static inline void dec_nr_running(struct rq *rq) extern void update_rq_clock(struct rq *rq); +static inline void update_nohz_rq_clock(struct rq *rq) +{ + if (tick_nohz_full_cpu(cpu_of(rq))) + update_rq_clock(rq); +} + extern void activate_task(struct rq *rq, struct task_struct *p, int flags); extern void deactivate_task(struct rq *rq, struct task_struct *p, int flags); -- 1.7.5.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/