Skip to content

Commit 25b3e5a

Browse files
Rik van RielIngo Molnar
authored andcommitted
sched/numa: Fix math underflow in task_tick_numa()
The NUMA balancing code implements delays in scanning by advancing curr->node_stamp beyond curr->se.sum_exec_runtime. With unsigned math, that creates an underflow, which results in task_numa_work being queued all the time, even when we don't want to. Avoiding the math underflow makes it possible to reduce CPU overhead in the NUMA balancing code. Reported-and-tested-by: Jan Stancek <[email protected]> Signed-off-by: Rik van Riel <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: [email protected] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent 66ef349 commit 25b3e5a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/sched/fair.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2302,7 +2302,7 @@ void task_tick_numa(struct rq *rq, struct task_struct *curr)
23022302
now = curr->se.sum_exec_runtime;
23032303
period = (u64)curr->numa_scan_period * NSEC_PER_MSEC;
23042304

2305-
if (now - curr->node_stamp > period) {
2305+
if (now > curr->node_stamp + period) {
23062306
if (!curr->node_stamp)
23072307
curr->numa_scan_period = task_scan_min(curr);
23082308
curr->node_stamp += period;

0 commit comments

Comments
 (0)