diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-04-27 20:18:40 +0300 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-04-27 20:18:40 +0300 |
commit | 15d4e26b816a39f2d1ba40bacb8e8ecf8884477c (patch) | |
tree | 4e19764816eded5f3fed5e2768c829d9beca6d53 /kernel | |
parent | 5084991663650a238dd9d1981e09eef00a90594c (diff) | |
parent | a860fa7b96e1a1c974556327aa1aee852d434c21 (diff) | |
download | linux-15d4e26b816a39f2d1ba40bacb8e8ecf8884477c.tar.xz |
Merge branch 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull scheduler fix from Ingo Molnar:
"Fix a division by zero bug that can trigger in the NUMA placement
code"
* 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
sched/numa: Fix a possible divide-by-zero
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/sched/fair.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index a4d9e14bf138..35f3ea375084 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -2007,6 +2007,10 @@ static u64 numa_get_avg_runtime(struct task_struct *p, u64 *period) if (p->last_task_numa_placement) { delta = runtime - p->last_sum_exec_runtime; *period = now - p->last_task_numa_placement; + + /* Avoid time going backwards, prevent potential divide error: */ + if (unlikely((s64)*period < 0)) + *period = 0; } else { delta = p->se.avg.load_sum; *period = LOAD_AVG_MAX; |