aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Yury Norov <yury.norov@gmail.com> 2023-08-19 07:12:34 -0700
committerGravatar Ingo Molnar <mingo@kernel.org> 2023-09-15 13:48:10 +0200
commitd1db9fb432d50b0eecdfdd85d17cc15a59cc093b (patch)
tree47f0754f44ce59c0f9f72ede2ca06c7e2f654d1f
parentnuma: Generalize numa_map_to_online_node() (diff)
downloadlinux-d1db9fb432d50b0eecdfdd85d17cc15a59cc093b.tar.gz
linux-d1db9fb432d50b0eecdfdd85d17cc15a59cc093b.tar.bz2
linux-d1db9fb432d50b0eecdfdd85d17cc15a59cc093b.zip
sched/fair: Fix open-coded numa_nearest_node()
task_numa_placement() searches for a nearest node to migrate by calling for_each_node_state(). Now that we have numa_nearest_node(), switch to using it. Signed-off-by: Yury Norov <yury.norov@gmail.com> Signed-off-by: Ingo Molnar <mingo@kernel.org> Cc: Mel Gorman <mgorman@suse.de> Link: https://lore.kernel.org/r/20230819141239.287290-3-yury.norov@gmail.com
-rw-r--r--kernel/sched/fair.c14
1 files changed, 1 insertions, 13 deletions
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 8dbff6e7ad4f..41cfd61b4d6b 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -2847,19 +2847,7 @@ static void task_numa_placement(struct task_struct *p)
}
/* Cannot migrate task to CPU-less node */
- if (max_nid != NUMA_NO_NODE && !node_state(max_nid, N_CPU)) {
- int near_nid = max_nid;
- int distance, near_distance = INT_MAX;
-
- for_each_node_state(nid, N_CPU) {
- distance = node_distance(max_nid, nid);
- if (distance < near_distance) {
- near_nid = nid;
- near_distance = distance;
- }
- }
- max_nid = near_nid;
- }
+ max_nid = numa_nearest_node(max_nid, N_CPU);
if (ng) {
numa_group_count_active_nodes(ng);