linux/arch/loongarch
Liam Ni 6fdc770506 NUMA: optimize detection of memory with no node id assigned by firmware
[ Upstream commit ff6c3d81f2 ]

Sanity check that makes sure the nodes cover all memory loops over
numa_meminfo to count the pages that have node id assigned by the
firmware, then loops again over memblock.memory to find the total amount
of memory and in the end checks that the difference between the total
memory and memory that covered by nodes is less than some threshold.
Worse, the loop over numa_meminfo calls __absent_pages_in_range() that
also partially traverses memblock.memory.

It's much simpler and more efficient to have a single traversal of
memblock.memory that verifies that amount of memory not covered by nodes
is less than a threshold.

Introduce memblock_validate_numa_coverage() that does exactly that and use
it instead of numa_meminfo_cover_memory().

Link: https://lkml.kernel.org/r/20231026020329.327329-1-zhiguangni01@gmail.com
Signed-off-by: Liam Ni <zhiguangni01@gmail.com>
Reviewed-by: Mike Rapoport (IBM) <rppt@kernel.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Bibo Mao <maobibo@loongson.cn>
Cc: Binbin Zhou <zhoubinbin@loongson.cn>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Feiyang Chen <chenfeiyang@loongson.cn>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Huacai Chen <chenhuacai@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: WANG Xuerui <kernel@xen0n.name>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Stable-dep-of: 9cdc6423ac ("memblock: allow zero threshold in validate_numa_converage()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2025-01-09 13:31:40 +01:00
..
boot loongarch: efi: enable generic EFI compressed boot 2022-09-20 09:50:31 +02:00
configs mm: z3fold: deprecate CONFIG_Z3FOLD 2024-10-10 11:58:02 +02:00
crypto LoongArch/crypto: Clean up useless assignment operations 2024-04-03 15:28:36 +02:00
include LoongArch: BPF: Adjust the parameter of emit_jirl() 2025-01-02 10:32:05 +01:00
kernel NUMA: optimize detection of memory with no node id assigned by firmware 2025-01-09 13:31:40 +01:00
lib LoongArch: Add KASAN (Kernel Address Sanitizer) support 2023-09-06 22:54:16 +08:00
mm LoongArch: Fix sleeping in atomic context for PREEMPT_RT 2024-12-14 20:00:15 +01:00
net LoongArch: BPF: Adjust the parameter of emit_jirl() 2025-01-02 10:32:05 +01:00
pci LoongArch: Fix memleak in pci_acpi_scan_root() 2024-10-17 15:24:20 +02:00
power LoongArch: Export some arch-specific pm interfaces 2023-06-29 20:58:44 +08:00
vdso LoongArch: Fix build failure with GCC 15 (-std=gnu23) 2024-12-09 10:32:31 +01:00
Kbuild LoongArch: Add BPF JIT support 2022-10-12 16:36:20 +08:00
Kconfig LoongArch: Select HAVE_ARCH_SECCOMP to use the common SECCOMP menu 2024-03-01 13:34:55 +01:00
Kconfig.debug LoongArch: Add prologue unwinder support 2022-08-12 13:10:11 +08:00
Makefile kbuild: unify vdso_install rules 2024-06-12 11:12:32 +02:00