drivers/arch_numa: remove rebudant setup_per_cpu_areas()
Subsystems (2)
PATCH 1/1 drivers/arch_numa: remove rebudant setup_per_cpu_areas()
There are two identical implementations of setup_per_cpu_areas() in mm/percpu.c and drivers/base/arch_numa.c.
Hence removing the one in arch_numa.c. And let arm64 drop HAVE_SETUP_PER_CPU_AREA.
--- arch/arm64/Kconfig | 4 ---- drivers/base/arch_numa.c | 22 ---------------------- 2 files changed, 26 deletions(-)
arch/arm64/Kconfig +0 -4
@@ -1022,10 +1022,6 @@ config USE_PERCPU_NUMA_NODE_ID def_bool y depends on NUMA -config HAVE_SETUP_PER_CPU_AREA - def_bool y - depends on NUMA - config NEED_PER_CPU_EMBED_FIRST_CHUNK def_bool y depends on NUMA
drivers/base/arch_numa.c +0 -22
@@ -167,28 +167,6 @@ static void __init pcpu_fc_free(void *ptr, size_t size) {memblock_free_early (__pa (ptr), size); } - -void __init setup_per_cpu_areas (void ) -{ -unsigned long delta; -unsigned int cpu; -int rc; - -/* -* Always reserve area for module percpu variables. That's -* what the legacy allocator did. -*/ - rc =pcpu_embed_first_chunk (PERCPU_MODULE_RESERVE , -PERCPU_DYNAMIC_RESERVE ,PAGE_SIZE , - pcpu_cpu_distance, - pcpu_fc_alloc, pcpu_fc_free); -if (rc <0 ) -panic ("Failed to initialize percpu areas." ); - - delta = (unsigned long )pcpu_base_addr - (unsigned long )__per_cpu_start; -for_each_possible_cpu (cpu) - __per_cpu_offset[cpu] = delta + pcpu_unit_offsets[cpu]; -}#endif /**
Signature · 1 line
2.29.2
Will Deacon
maintainer[typo in subject "rebudant"]
Quoted 47 lines · Pingfan Liu
There are two identical implementations of
setup_per_cpu_areas()inmm/percpu.canddrivers/base/arch_numa.c.Hence removing the one in
arch_numa.c. And let arm64 dropHAVE_SETUP_PER_CPU_AREA.Signed-off-by Pingfan Liu <[email protected]>Cc Catalin Marinas <[email protected]>Cc Will Deacon <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Cc "Rafael J. Wysocki" <[email protected]>Cc Atish Patra <[email protected]>--- arch/arm64/Kconfig | 4 ---- drivers/base/arch_numa.c | 22 ---------------------- 2 files changed, 26 deletions(-)arch/arm64/Kconfig +0
-4@@ -1022,10 +1022,6 @@ config USE_PERCPU_NUMA_NODE_ID def_bool y depends on NUMA -config HAVE_SETUP_PER_CPU_AREA - def_bool y - depends on NUMA - config NEED_PER_CPU_EMBED_FIRST_CHUNK def_bool y depends on NUMAdrivers/base/arch_numa.c +0
-5@@ -167,28 +167,6 @@ static void __init pcpu_fc_free(void *ptr, size_t size) {memblock_free_early (__pa (ptr), size); } - -void __init setup_per_cpu_areas (void ) -{ -unsigned long delta; -unsigned int cpu;
drivers/base/arch_numa.c static void __init pcpu_fc_free(void *ptr, size_t size) · line 184
Quoted 10 lines
drivers/base/arch_numa.c +0
-10-int rc; - -/* -* Always reserve area for module percpu variables. That's -* what the legacy allocator did. -*/ - rc =pcpu_embed_first_chunk (PERCPU_MODULE_RESERVE , -PERCPU_DYNAMIC_RESERVE ,PAGE_SIZE , - pcpu_cpu_distance, - pcpu_fc_alloc, pcpu_fc_free);
This doesn't look identical to the version in mm/percpu.c -- that one passes NULL instead of 'pcpu_cpu_distance' and tries to allocate the pcpu memory on the relevant NUMA nodes. In fact, if you could remove this function, you could probably remove the whole HAVE_SETUP_PER_CPU_AREA block here as the other functions are just used as helpers. So I'm not sure this is valid.
Will
Quoted 59 lines · Will Deacon
[typo in subject "rebudant"]
Quoted 55 lines · Pingfan Liu
There are two identical implementations of
setup_per_cpu_areas()inmm/percpu.canddrivers/base/arch_numa.c.Hence removing the one in
arch_numa.c. And let arm64 dropHAVE_SETUP_PER_CPU_AREA.Signed-off-by Pingfan Liu <[email protected]>Cc Catalin Marinas <[email protected]>Cc Will Deacon <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Cc "Rafael J. Wysocki" <[email protected]>Cc Atish Patra <[email protected]>--- arch/arm64/Kconfig | 4 ---- drivers/base/arch_numa.c | 22 ---------------------- 2 files changed, 26 deletions(-)arch/arm64/Kconfig +0
-4@@ -1022,10 +1022,6 @@ config USE_PERCPU_NUMA_NODE_ID def_bool y depends on NUMA -config HAVE_SETUP_PER_CPU_AREA - def_bool y - depends on NUMA - config NEED_PER_CPU_EMBED_FIRST_CHUNK def_bool y depends on NUMAdrivers/base/arch_numa.c +0
-13@@ -167,28 +167,6 @@ static void __init pcpu_fc_free(void *ptr, size_t size) {memblock_free_early (__pa (ptr), size); } - -void __init setup_per_cpu_areas (void ) -{ -unsigned long delta; -unsigned int cpu; -int rc; - -/* -* Always reserve area for module percpu variables. That's -* what the legacy allocator did. -*/ - rc = pcpu_embed_first_chunk(PERCPU_MODULE_RESERVE, - PERCPU_DYNAMIC_RESERVE, PAGE_SIZE,
Quoted 9 lines
drivers/base/arch_numa.c static void __init pcpu_fc_free(void *ptr, size_t size) · line 184
Quoted 2 lines
drivers/base/arch_numa.c +0
-2- pcpu_cpu_distance, - pcpu_fc_alloc, pcpu_fc_free);This doesn't look identical to the version in
mm/percpu.c-- that one passes NULL instead of 'pcpu_cpu_distance' and tries to allocate the pcpu memory on the relevant NUMA nodes. In fact, if you could remove this function, you could probably remove the wholeHAVE_SETUP_PER_CPU_AREAblock here as the other functions are just used as helpers. So I'm not sure this is valid.
You are right. I need to rethink about it to see whether these two functions can be unified into one.
Thanks,
Pingfan