summaryrefslogtreecommitdiff
path: root/lib/atomic64.c
diff options
context:
space:
mode:
authorXie XiuQi <xiexiuqi@huawei.com>2019-04-20 16:34:16 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-05-16 19:44:43 +0200
commit2f14dae91560e36ada26e4019f40ddf1798d7b70 (patch)
tree385853a169a17efc0ada26b39ea913740d6493ab /lib/atomic64.c
parent10dbe22927586c60c6344a37e8fc6bbbc7e3ada5 (diff)
sched/numa: Fix a possible divide-by-zero
commit a860fa7b96e1a1c974556327aa1aee852d434c21 upstream. sched_clock_cpu() may not be consistent between CPUs. If a task migrates to another CPU, then se.exec_start is set to that CPU's rq_clock_task() by update_stats_curr_start(). Specifically, the new value might be before the old value due to clock skew. So then if in numa_get_avg_runtime() the expression: 'now - p->last_task_numa_placement' ends up as -1, then the divider '*period + 1' in task_numa_placement() is 0 and things go bang. Similar to update_curr(), check if time goes backwards to avoid this. [ peterz: Wrote new changelog. ] [ mingo: Tweaked the code comment. ] Signed-off-by: Xie XiuQi <xiexiuqi@huawei.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: cj.chengjian@huawei.com Cc: <stable@vger.kernel.org> Link: http://lkml.kernel.org/r/20190425080016.GX11158@hirez.programming.kicks-ass.net Signed-off-by: Ingo Molnar <mingo@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'lib/atomic64.c')
0 files changed, 0 insertions, 0 deletions