From: Frederic Weisbecker 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 Cc: Alessio Igor Bogani Cc: Andrew Morton Cc: Avi Kivity Cc: Chris Metcalf Cc: Christoph Lameter Cc: Daniel Lezcano Cc: Geoff Levand Cc: Gilad Ben Yossef Cc: Hakan Akkan Cc: Ingo Molnar Cc: Kevin Hilman Cc: Max Krasnyansky Cc: Paul E. McKenney Cc: Peter Zijlstra Cc: Stephen Hemminger Cc: Steven Rostedt Cc: Sven-Thorsten Dietrich Cc: Thomas Gleixner --- kernel/sched/core.c | 6 ++++++ kernel/sched/sched.h | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 783d5e4..f0fa54d 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -4851,6 +4851,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 c6cd9ec..1956494 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -948,6 +948,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 (cpuset_cpu_adaptive_nohz(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.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/