mirror of https://gitee.com/openkylin/linux.git
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
This commit is contained in:
commit
15d4e26b81
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue