hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/ID4GC1 -------------------------------- The 'node_reclaim_distance' parameter influences both scheduling decisions and memory reclamation behavior. Currently, this value is fixed to its default setting and cannot be configured. During node reclaim operations, memory reclamation is only permitted when the distance between nodes is no bigger than the threshold defined by 'zone_allows_reclaim'. This restriction limits the flexibility of the node reclaim mechanism. This patch introduces the capability to adjust the 'node_reclaim_distance' parameter, allowing for more fine-grained control over node reclaim behavior. Commit 932fcc5ecb9a ("arm64/numa: Support node_reclaim_distance adjust for arch") introduced node_reclaim_distance adjustment for arm64. However, this feature was disabled by default in commit f5aef354d409 ("config: Disable CONFIG_ARCH_CUSTOM_NUMA_DISTANCE for arm64"). Since zone reclaim already depends on zone_allows_reclaim() for fine-grained control, move this logic outside of CONFIG_ARCH_CUSTOM_NUMA_DISTANCE to make it available by default on arm64. This gives users the ability to precisely tune zone reclaim behavior without requiring special configuration. Signed-off-by: Wupeng Ma <mawupeng1@huawei.com> --- drivers/base/arch_numa.c | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/drivers/base/arch_numa.c b/drivers/base/arch_numa.c index 0e615ed23635..f1a86af00d25 100644 --- a/drivers/base/arch_numa.c +++ b/drivers/base/arch_numa.c @@ -190,8 +190,27 @@ void __init setup_per_cpu_areas(void) } #endif -#ifdef CONFIG_ARCH_CUSTOM_NUMA_DISTANCE #define DISTANCE_MAX (1 << DISTANCE_BITS) +int __init node_reclaim_distance_setup(char *str) +{ + int val; + + if (kstrtoint(str, 0, &val)) + return -EINVAL; + + if (val < LOCAL_DISTANCE || val >= DISTANCE_MAX) + return -EINVAL; + + if (val != RECLAIM_DISTANCE) { + node_reclaim_distance = val; + pr_info("Force set node_reclaim_distance to %d\n", val); + } + + return 0; +} +early_param("node_reclaim_distance", node_reclaim_distance_setup); + +#ifdef CONFIG_ARCH_CUSTOM_NUMA_DISTANCE static void get_numa_distance_info(int *numa_levels, int *max_distance) { DECLARE_BITMAP(distance_map, DISTANCE_MAX); @@ -222,25 +241,6 @@ static void get_numa_distance_info(int *numa_levels, int *max_distance) *max_distance = max; } -static int __init node_reclaim_distance_setup(char *str) -{ - int val; - - if (kstrtoint(str, 0, &val)) - return -EINVAL; - - if (val < LOCAL_DISTANCE || val >= DISTANCE_MAX) - return -EINVAL; - - if (val != RECLAIM_DISTANCE) { - node_reclaim_distance = val; - pr_info("Force set node_reclaim_distance to %d\n", val); - } - - return 0; -} -early_param("node_reclaim_distance", node_reclaim_distance_setup); - static void __init node_reclaim_distance_adjust(void) { unsigned int model = read_cpuid_id() & MIDR_CPU_MODEL_MASK; -- 2.43.0