| From: "Mike Rapoport (Microsoft)" <rppt@kernel.org> |
| Subject: mm: move kernel/numa.c to mm/ |
| Date: Wed, 7 Aug 2024 09:40:45 +0300 |
| |
| Patch series "mm: introduce numa_memblks", v4. |
| |
| Following the discussion about handling of CXL fixed memory windows on |
| arm64 [1] I decided to bite the bullet and move numa_memblks from x86 to |
| the generic code so they will be available on arm64/riscv and maybe on |
| loongarch sometime later. |
| |
| While it could be possible to use memblock to describe CXL memory windows, |
| it currently lacks notion of unpopulated memory ranges and numa_memblks |
| does implement this. |
| |
| Another reason to make numa_memblks generic is that both arch_numa (arm64 |
| and riscv) and loongarch use trimmed copy of x86 code although there is no |
| fundamental reason why the same code cannot be used on all these |
| platforms. Having numa_memblks in mm/ will make it's interaction with |
| ACPI and FDT more consistent and I believe will reduce maintenance burden. |
| |
| And with generic numa_memblks it is (almost) straightforward to enable |
| NUMA emulation on arm64 and riscv. |
| |
| The first 9 commits in this series are cleanups that are not strictly |
| related to numa_memblks. |
| Commits 10-16 slightly reorder code in x86 to allow extracting numa_memblks |
| and NUMA emulation to the generic code. |
| Commits 17-19 actually move the code from arch/x86/ to mm/ and commits 20-22 |
| does some aftermath cleanups. |
| Commit 23 updates of_numa_init() to return error of no NUMA nodes were |
| found in the device tree. |
| Commit 24 switches arch_numa to numa_memblks. |
| Commit 25 enables usage of phys_to_target_node() and |
| memory_add_physaddr_to_nid() with numa_memblks. |
| Commit 26 moves the description for numa=fake from x86 to admin-guide. |
| |
| [1] https://lore.kernel.org/all/20240529171236.32002-1-Jonathan.Cameron@huawei.com/ |
| |
| |
| This patch (of 26): |
| |
| The stub functions in kernel/numa.c belong to mm/ rather than to kernel/ |
| |
| Link: https://lkml.kernel.org/r/20240807064110.1003856-1-rppt@kernel.org |
| Link: https://lkml.kernel.org/r/20240807064110.1003856-2-rppt@kernel.org |
| Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org> |
| Acked-by: David Hildenbrand <david@redhat.com> |
| Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> |
| Tested-by: Zi Yan <ziy@nvidia.com> # for x86_64 and arm64 |
| Tested-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> [arm64 + CXL via QEMU] |
| Acked-by: Dan Williams <dan.j.williams@intel.com> |
| Cc: Alexander Gordeev <agordeev@linux.ibm.com> |
| Cc: Andreas Larsson <andreas@gaisler.com> |
| Cc: Arnd Bergmann <arnd@arndb.de> |
| Cc: Borislav Petkov <bp@alien8.de> |
| Cc: Catalin Marinas <catalin.marinas@arm.com> |
| Cc: Christophe Leroy <christophe.leroy@csgroup.eu> |
| Cc: Dave Hansen <dave.hansen@linux.intel.com> |
| Cc: Davidlohr Bueso <dave@stgolabs.net> |
| Cc: David S. Miller <davem@davemloft.net> |
| Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
| Cc: Heiko Carstens <hca@linux.ibm.com> |
| Cc: Huacai Chen <chenhuacai@kernel.org> |
| Cc: Ingo Molnar <mingo@redhat.com> |
| Cc: Jiaxun Yang <jiaxun.yang@flygoat.com> |
| Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> |
| Cc: Jonathan Corbet <corbet@lwn.net> |
| Cc: Michael Ellerman <mpe@ellerman.id.au> |
| Cc: Palmer Dabbelt <palmer@dabbelt.com> |
| Cc: Rafael J. Wysocki <rafael@kernel.org> |
| Cc: Rob Herring (Arm) <robh@kernel.org> |
| Cc: Samuel Holland <samuel.holland@sifive.com> |
| Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de> |
| Cc: Thomas Gleixner <tglx@linutronix.de> |
| Cc: Vasily Gorbik <gor@linux.ibm.com> |
| Cc: Will Deacon <will@kernel.org> |
| Signed-off-by: Andrew Morton <akpm@linux-foundation.org> |
| --- |
| |
| kernel/Makefile | 1 - |
| kernel/numa.c | 26 -------------------------- |
| mm/Makefile | 1 + |
| mm/numa.c | 26 ++++++++++++++++++++++++++ |
| 4 files changed, 27 insertions(+), 27 deletions(-) |
| |
| --- a/kernel/Makefile~mm-move-kernel-numac-to-mm |
| +++ a/kernel/Makefile |
| @@ -116,7 +116,6 @@ obj-$(CONFIG_SHADOW_CALL_STACK) += scs.o |
| obj-$(CONFIG_HAVE_STATIC_CALL) += static_call.o |
| obj-$(CONFIG_HAVE_STATIC_CALL_INLINE) += static_call_inline.o |
| obj-$(CONFIG_CFI_CLANG) += cfi.o |
| -obj-$(CONFIG_NUMA) += numa.o |
| |
| obj-$(CONFIG_PERF_EVENTS) += events/ |
| |
| diff --git a/kernel/numa.c a/kernel/numa.c |
| deleted file mode 100644 |
| --- a/kernel/numa.c |
| +++ /dev/null |
| @@ -1,26 +0,0 @@ |
| -// SPDX-License-Identifier: GPL-2.0-or-later |
| - |
| -#include <linux/printk.h> |
| -#include <linux/numa.h> |
| - |
| -/* Stub functions: */ |
| - |
| -#ifndef memory_add_physaddr_to_nid |
| -int memory_add_physaddr_to_nid(u64 start) |
| -{ |
| - pr_info_once("Unknown online node for memory at 0x%llx, assuming node 0\n", |
| - start); |
| - return 0; |
| -} |
| -EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid); |
| -#endif |
| - |
| -#ifndef phys_to_target_node |
| -int phys_to_target_node(u64 start) |
| -{ |
| - pr_info_once("Unknown target node for memory at 0x%llx, assuming node 0\n", |
| - start); |
| - return 0; |
| -} |
| -EXPORT_SYMBOL_GPL(phys_to_target_node); |
| -#endif |
| --- a/mm/Makefile~mm-move-kernel-numac-to-mm |
| +++ a/mm/Makefile |
| @@ -117,6 +117,7 @@ obj-$(CONFIG_ZSMALLOC) += zsmalloc.o |
| obj-$(CONFIG_Z3FOLD) += z3fold.o |
| obj-$(CONFIG_GENERIC_EARLY_IOREMAP) += early_ioremap.o |
| obj-$(CONFIG_CMA) += cma.o |
| +obj-$(CONFIG_NUMA) += numa.o |
| obj-$(CONFIG_MEMORY_BALLOON) += balloon_compaction.o |
| obj-$(CONFIG_PAGE_EXTENSION) += page_ext.o |
| obj-$(CONFIG_PAGE_TABLE_CHECK) += page_table_check.o |
| diff --git a/mm/numa.c a/mm/numa.c |
| new file mode 100644 |
| --- /dev/null |
| +++ a/mm/numa.c |
| @@ -0,0 +1,26 @@ |
| +// SPDX-License-Identifier: GPL-2.0-or-later |
| + |
| +#include <linux/printk.h> |
| +#include <linux/numa.h> |
| + |
| +/* Stub functions: */ |
| + |
| +#ifndef memory_add_physaddr_to_nid |
| +int memory_add_physaddr_to_nid(u64 start) |
| +{ |
| + pr_info_once("Unknown online node for memory at 0x%llx, assuming node 0\n", |
| + start); |
| + return 0; |
| +} |
| +EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid); |
| +#endif |
| + |
| +#ifndef phys_to_target_node |
| +int phys_to_target_node(u64 start) |
| +{ |
| + pr_info_once("Unknown target node for memory at 0x%llx, assuming node 0\n", |
| + start); |
| + return 0; |
| +} |
| +EXPORT_SYMBOL_GPL(phys_to_target_node); |
| +#endif |
| _ |