Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm: percpu: generalize percpu related config

Patch series "mm: percpu: Cleanup percpu first chunk function".

When supporting page mapping percpu first chunk allocator on arm64, we
found there are lots of duplicated codes in percpu embed/page first chunk
allocator. This patchset is aimed to cleanup them and should no function
change.

The currently supported status about 'embed' and 'page' in Archs shows
below,

embed: NEED_PER_CPU_PAGE_FIRST_CHUNK
page: NEED_PER_CPU_EMBED_FIRST_CHUNK

embed page
------------------------
arm64 Y Y
mips Y N
powerpc Y Y
riscv Y N
sparc Y Y
x86 Y Y
------------------------

There are two interfaces about percpu first chunk allocator,

extern int __init pcpu_embed_first_chunk(size_t reserved_size, size_t dyn_size,
size_t atom_size,
pcpu_fc_cpu_distance_fn_t cpu_distance_fn,
- pcpu_fc_alloc_fn_t alloc_fn,
- pcpu_fc_free_fn_t free_fn);
+ pcpu_fc_cpu_to_node_fn_t cpu_to_nd_fn);

extern int __init pcpu_page_first_chunk(size_t reserved_size,
- pcpu_fc_alloc_fn_t alloc_fn,
- pcpu_fc_free_fn_t free_fn,
- pcpu_fc_populate_pte_fn_t populate_pte_fn);
+ pcpu_fc_cpu_to_node_fn_t cpu_to_nd_fn);

The pcpu_fc_alloc_fn_t/pcpu_fc_free_fn_t is killed, we provide generic
pcpu_fc_alloc() and pcpu_fc_free() function, which are called in the
pcpu_embed/page_first_chunk().

1) For pcpu_embed_first_chunk(), pcpu_fc_cpu_to_node_fn_t is needed to be
provided when archs supported NUMA.

2) For pcpu_page_first_chunk(), the pcpu_fc_populate_pte_fn_t is killed too,
a generic pcpu_populate_pte() which marked '__weak' is provided, if you
need a different function to populate pte on the arch(like x86), please
provide its own implementation.

[1] https://github.com/kevin78/linux.git percpu-cleanup

This patch (of 4):

The HAVE_SETUP_PER_CPU_AREA/NEED_PER_CPU_EMBED_FIRST_CHUNK/
NEED_PER_CPU_PAGE_FIRST_CHUNK/USE_PERCPU_NUMA_NODE_ID configs, which have
duplicate definitions on platforms that subscribe it.

Move them into mm, drop these redundant definitions and instead just
select it on applicable platforms.

Link: https://lkml.kernel.org/r/20211216112359.103822-1-wangkefeng.wang@huawei.com
Link: https://lkml.kernel.org/r/20211216112359.103822-2-wangkefeng.wang@huawei.com
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com> [arm64]
Cc: Will Deacon <will@kernel.org>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Paul Walmsley <paul.walmsley@sifive.com>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Albert Ou <aou@eecs.berkeley.edu>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Christoph Lameter <cl@linux.com>
Cc: Dennis Zhou <dennis@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Kefeng Wang and committed by
Linus Torvalds
7ecd19cf df0cc57e

+33 -74
+4 -16
arch/arm64/Kconfig
··· 1135 1135 select GENERIC_ARCH_NUMA 1136 1136 select ACPI_NUMA if ACPI 1137 1137 select OF_NUMA 1138 + select HAVE_SETUP_PER_CPU_AREA 1139 + select NEED_PER_CPU_EMBED_FIRST_CHUNK 1140 + select NEED_PER_CPU_PAGE_FIRST_CHUNK 1141 + select USE_PERCPU_NUMA_NODE_ID 1138 1142 help 1139 1143 Enable NUMA (Non-Uniform Memory Access) support. 1140 1144 ··· 1154 1150 help 1155 1151 Specify the maximum number of NUMA Nodes available on the target 1156 1152 system. Increases memory reserved to accommodate various tables. 1157 - 1158 - config USE_PERCPU_NUMA_NODE_ID 1159 - def_bool y 1160 - depends on NUMA 1161 - 1162 - config HAVE_SETUP_PER_CPU_AREA 1163 - def_bool y 1164 - depends on NUMA 1165 - 1166 - config NEED_PER_CPU_EMBED_FIRST_CHUNK 1167 - def_bool y 1168 - depends on NUMA 1169 - 1170 - config NEED_PER_CPU_PAGE_FIRST_CHUNK 1171 - def_bool y 1172 - depends on NUMA 1173 1153 1174 1154 source "kernel/Kconfig.hz" 1175 1155
+2 -7
arch/ia64/Kconfig
··· 32 32 select HAVE_FTRACE_MCOUNT_RECORD 33 33 select HAVE_DYNAMIC_FTRACE if (!ITANIUM) 34 34 select HAVE_FUNCTION_TRACER 35 + select HAVE_SETUP_PER_CPU_AREA 35 36 select TTY 36 37 select HAVE_ARCH_TRACEHOOK 37 38 select HAVE_VIRT_CPU_ACCOUNTING ··· 88 87 config GENERIC_CALIBRATE_DELAY 89 88 bool 90 89 default y 91 - 92 - config HAVE_SETUP_PER_CPU_AREA 93 - def_bool y 94 90 95 91 config DMI 96 92 bool ··· 290 292 bool "NUMA support" 291 293 depends on !FLATMEM 292 294 select SMP 295 + select USE_PERCPU_NUMA_NODE_ID 293 296 help 294 297 Say Y to compile the kernel to support NUMA (Non-Uniform Memory 295 298 Access). This option is for configuring high-end multiprocessor ··· 307 308 If in doubt, use the default. 308 309 309 310 config HAVE_ARCH_NODEDATA_EXTENSION 310 - def_bool y 311 - depends on NUMA 312 - 313 - config USE_PERCPU_NUMA_NODE_ID 314 311 def_bool y 315 312 depends on NUMA 316 313
+2 -8
arch/mips/Kconfig
··· 2666 2666 bool "NUMA Support" 2667 2667 depends on SYS_SUPPORTS_NUMA 2668 2668 select SMP 2669 + select HAVE_SETUP_PER_CPU_AREA 2670 + select NEED_PER_CPU_EMBED_FIRST_CHUNK 2669 2671 help 2670 2672 Say Y to compile the kernel to support NUMA (Non-Uniform Memory 2671 2673 Access). This option improves performance on systems with more ··· 2677 2675 2678 2676 config SYS_SUPPORTS_NUMA 2679 2677 bool 2680 - 2681 - config HAVE_SETUP_PER_CPU_AREA 2682 - def_bool y 2683 - depends on NUMA 2684 - 2685 - config NEED_PER_CPU_EMBED_FIRST_CHUNK 2686 - def_bool y 2687 - depends on NUMA 2688 2678 2689 2679 config RELOCATABLE 2690 2680 bool "Relocatable kernel"
+4 -13
arch/powerpc/Kconfig
··· 55 55 default 9 if PPC_16K_PAGES # 9 = 23 (8MB) - 14 (16K) 56 56 default 11 # 11 = 23 (8MB) - 12 (4K) 57 57 58 - config HAVE_SETUP_PER_CPU_AREA 59 - def_bool PPC64 60 - 61 - config NEED_PER_CPU_EMBED_FIRST_CHUNK 62 - def_bool y if PPC64 63 - 64 - config NEED_PER_CPU_PAGE_FIRST_CHUNK 65 - def_bool y if PPC64 66 - 67 58 config NR_IRQS 68 59 int "Number of virtual interrupt numbers" 69 60 range 32 1048576 ··· 231 240 select HAVE_REGS_AND_STACK_ACCESS_API 232 241 select HAVE_RELIABLE_STACKTRACE 233 242 select HAVE_RSEQ 243 + select HAVE_SETUP_PER_CPU_AREA if PPC64 234 244 select HAVE_SOFTIRQ_ON_OWN_STACK 235 245 select HAVE_STACKPROTECTOR if PPC32 && $(cc-option,-mstack-protector-guard=tls -mstack-protector-guard-reg=r2) 236 246 select HAVE_STACKPROTECTOR if PPC64 && $(cc-option,-mstack-protector-guard=tls -mstack-protector-guard-reg=r13) ··· 246 254 select MMU_GATHER_RCU_TABLE_FREE 247 255 select MODULES_USE_ELF_RELA 248 256 select NEED_DMA_MAP_STATE if PPC64 || NOT_COHERENT_CACHE 257 + select NEED_PER_CPU_EMBED_FIRST_CHUNK if PPC64 258 + select NEED_PER_CPU_PAGE_FIRST_CHUNK if PPC64 249 259 select NEED_SG_DMA_LENGTH 250 260 select OF 251 261 select OF_DMA_DEFAULT_COHERENT if !NOT_COHERENT_CACHE ··· 653 659 bool "NUMA Memory Allocation and Scheduler Support" 654 660 depends on PPC64 && SMP 655 661 default y if PPC_PSERIES || PPC_POWERNV 662 + select USE_PERCPU_NUMA_NODE_ID 656 663 help 657 664 Enable NUMA (Non-Uniform Memory Access) support. 658 665 ··· 665 670 int 666 671 default "8" if PPC64 667 672 default "4" 668 - depends on NUMA 669 - 670 - config USE_PERCPU_NUMA_NODE_ID 671 - def_bool y 672 673 depends on NUMA 673 674 674 675 config HAVE_MEMORYLESS_NODES
+2 -8
arch/riscv/Kconfig
··· 334 334 select GENERIC_ARCH_NUMA 335 335 select OF_NUMA 336 336 select ARCH_SUPPORTS_NUMA_BALANCING 337 + select USE_PERCPU_NUMA_NODE_ID 338 + select NEED_PER_CPU_EMBED_FIRST_CHUNK 337 339 help 338 340 Enable NUMA (Non-Uniform Memory Access) support. 339 341 ··· 350 348 help 351 349 Specify the maximum number of NUMA Nodes available on the target 352 350 system. Increases memory reserved to accommodate various tables. 353 - 354 - config USE_PERCPU_NUMA_NODE_ID 355 - def_bool y 356 - depends on NUMA 357 - 358 - config NEED_PER_CPU_EMBED_FIRST_CHUNK 359 - def_bool y 360 - depends on NUMA 361 351 362 352 config RISCV_ISA_C 363 353 bool "Emit compressed instructions when building Linux"
+3 -9
arch/sparc/Kconfig
··· 97 97 select PCI_DOMAINS if PCI 98 98 select ARCH_HAS_GIGANTIC_PAGE 99 99 select HAVE_SOFTIRQ_ON_OWN_STACK 100 + select HAVE_SETUP_PER_CPU_AREA 101 + select NEED_PER_CPU_EMBED_FIRST_CHUNK 102 + select NEED_PER_CPU_PAGE_FIRST_CHUNK 100 103 101 104 config ARCH_PROC_KCORE_TEXT 102 105 def_bool y ··· 125 122 config AUDIT_ARCH 126 123 bool 127 124 default y 128 - 129 - config HAVE_SETUP_PER_CPU_AREA 130 - def_bool y if SPARC64 131 - 132 - config NEED_PER_CPU_EMBED_FIRST_CHUNK 133 - def_bool y if SPARC64 134 - 135 - config NEED_PER_CPU_PAGE_FIRST_CHUNK 136 - def_bool y if SPARC64 137 125 138 126 config MMU 139 127 bool
+4 -13
arch/x86/Kconfig
··· 239 239 select HAVE_REGS_AND_STACK_ACCESS_API 240 240 select HAVE_RELIABLE_STACKTRACE if X86_64 && (UNWINDER_FRAME_POINTER || UNWINDER_ORC) && STACK_VALIDATION 241 241 select HAVE_FUNCTION_ARG_ACCESS_API 242 + select HAVE_SETUP_PER_CPU_AREA 242 243 select HAVE_SOFTIRQ_ON_OWN_STACK 243 244 select HAVE_STACKPROTECTOR if CC_HAS_SANE_STACKPROTECTOR 244 245 select HAVE_STACK_VALIDATION if X86_64 ··· 253 252 select HAVE_GENERIC_VDSO 254 253 select HOTPLUG_SMT if SMP 255 254 select IRQ_FORCED_THREADING 255 + select NEED_PER_CPU_EMBED_FIRST_CHUNK 256 + select NEED_PER_CPU_PAGE_FIRST_CHUNK 256 257 select NEED_SG_DMA_LENGTH 257 258 select PCI_DOMAINS if PCI 258 259 select PCI_LOCKLESS_CONFIG if PCI ··· 332 329 def_bool y 333 330 334 331 config ARCH_HAS_FILTER_PGPROT 335 - def_bool y 336 - 337 - config HAVE_SETUP_PER_CPU_AREA 338 - def_bool y 339 - 340 - config NEED_PER_CPU_EMBED_FIRST_CHUNK 341 - def_bool y 342 - 343 - config NEED_PER_CPU_PAGE_FIRST_CHUNK 344 332 def_bool y 345 333 346 334 config ARCH_HIBERNATION_POSSIBLE ··· 1551 1557 depends on SMP 1552 1558 depends on X86_64 || (X86_32 && HIGHMEM64G && X86_BIGSMP) 1553 1559 default y if X86_BIGSMP 1560 + select USE_PERCPU_NUMA_NODE_ID 1554 1561 help 1555 1562 Enable NUMA (Non-Uniform Memory Access) support. 1556 1563 ··· 2425 2430 2426 2431 config ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE 2427 2432 def_bool y 2428 - 2429 - config USE_PERCPU_NUMA_NODE_ID 2430 - def_bool y 2431 - depends on NUMA 2432 2433 2433 2434 menu "Power management and ACPI options" 2434 2435
+12
mm/Kconfig
··· 432 432 bool 433 433 default y 434 434 435 + config NEED_PER_CPU_EMBED_FIRST_CHUNK 436 + bool 437 + 438 + config NEED_PER_CPU_PAGE_FIRST_CHUNK 439 + bool 440 + 441 + config USE_PERCPU_NUMA_NODE_ID 442 + bool 443 + 444 + config HAVE_SETUP_PER_CPU_AREA 445 + bool 446 + 435 447 config CLEANCACHE 436 448 bool "Enable cleancache driver to cache clean pages if tmem is present" 437 449 help