numa: Generalize numa_map_to_online_node()
authorYury Norov <yury.norov@gmail.com>
Sat, 19 Aug 2023 14:12:33 +0000 (07:12 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 20 Nov 2023 10:58:51 +0000 (11:58 +0100)
commit52cacc5c1b6200ffaac7ee7649b62ea42f51d628
tree69de1dbb5521b20ff85ecaac345a4540374d5415
parent5119ba542479dd2ebfc616413f33650b77f30d30
numa: Generalize numa_map_to_online_node()

[ Upstream commit b1f099b1cf51d553c510c6c8141c27d9ba7ea1fe ]

The function in fact searches the nearest node for a given one,
based on a N_ONLINE state. This is a common pattern to search
for a nearest node.

This patch converts numa_map_to_online_node() to numa_nearest_node()
so that others won't need to opencode the logic.

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-2-yury.norov@gmail.com
Stable-dep-of: 617f2c38cb5c ("sched/topology: Fix sched_numa_find_nth_cpu() in CPU-less case")
Signed-off-by: Sasha Levin <sashal@kernel.org>
include/linux/numa.h
mm/mempolicy.c