File tree Expand file tree Collapse file tree 1 file changed +23
-2
lines changed Expand file tree Collapse file tree 1 file changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -2617,11 +2617,32 @@ static void update_scan_period(struct task_struct *p, int new_cpu)
2617
2617
int src_nid = cpu_to_node (task_cpu (p ));
2618
2618
int dst_nid = cpu_to_node (new_cpu );
2619
2619
2620
+ if (!static_branch_likely (& sched_numa_balancing ))
2621
+ return ;
2622
+
2620
2623
if (!p -> mm || !p -> numa_faults || (p -> flags & PF_EXITING ))
2621
2624
return ;
2622
2625
2623
- if (src_nid != dst_nid )
2624
- p -> numa_scan_period = task_scan_start (p );
2626
+ if (src_nid == dst_nid )
2627
+ return ;
2628
+
2629
+ /*
2630
+ * Allow resets if faults have been trapped before one scan
2631
+ * has completed. This is most likely due to a new task that
2632
+ * is pulled cross-node due to wakeups or load balancing.
2633
+ */
2634
+ if (p -> numa_scan_seq ) {
2635
+ /*
2636
+ * Avoid scan adjustments if moving to the preferred
2637
+ * node or if the task was not previously running on
2638
+ * the preferred node.
2639
+ */
2640
+ if (dst_nid == p -> numa_preferred_nid ||
2641
+ (p -> numa_preferred_nid != -1 && src_nid != p -> numa_preferred_nid ))
2642
+ return ;
2643
+ }
2644
+
2645
+ p -> numa_scan_period = task_scan_start (p );
2625
2646
}
2626
2647
2627
2648
#else
You can’t perform that action at this time.
0 commit comments