]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
arch, mm: move definition of node_data to generic code
authorMike Rapoport (Microsoft) <rppt@kernel.org>
Wed, 7 Aug 2024 06:40:51 +0000 (09:40 +0300)
committerAndrew Morton <akpm@linux-foundation.org>
Sat, 17 Aug 2024 00:52:57 +0000 (17:52 -0700)
Every architecture that supports NUMA defines node_data in the same way:

struct pglist_data *node_data[MAX_NUMNODES];

No reason to keep multiple copies of this definition and its forward
declarations, especially when such forward declaration is the only thing
in include/asm/mmzone.h for many architectures.

Add definition and declaration of node_data to generic code and drop
architecture-specific versions.

Link: https://lkml.kernel.org/r/20240807064110.1003856-8-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>
Acked-by: Davidlohr Bueso <dave@stgolabs.net>
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: 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>
32 files changed:
arch/arm64/include/asm/Kbuild
arch/arm64/include/asm/mmzone.h [deleted file]
arch/arm64/include/asm/topology.h
arch/loongarch/include/asm/Kbuild
arch/loongarch/include/asm/mmzone.h [deleted file]
arch/loongarch/include/asm/topology.h
arch/loongarch/kernel/numa.c
arch/mips/include/asm/mach-ip27/mmzone.h
arch/mips/include/asm/mach-loongson64/mmzone.h
arch/mips/loongson64/numa.c
arch/mips/sgi-ip27/ip27-memory.c
arch/powerpc/include/asm/mmzone.h
arch/powerpc/mm/numa.c
arch/riscv/include/asm/Kbuild
arch/riscv/include/asm/mmzone.h [deleted file]
arch/riscv/include/asm/topology.h
arch/s390/include/asm/Kbuild
arch/s390/include/asm/mmzone.h [deleted file]
arch/s390/kernel/numa.c
arch/sh/include/asm/mmzone.h
arch/sh/mm/numa.c
arch/sparc/include/asm/mmzone.h
arch/sparc/mm/init_64.c
arch/x86/include/asm/Kbuild
arch/x86/include/asm/mmzone.h [deleted file]
arch/x86/include/asm/mmzone_32.h [deleted file]
arch/x86/include/asm/mmzone_64.h [deleted file]
arch/x86/mm/numa.c
drivers/base/arch_numa.c
include/asm-generic/mmzone.h [new file with mode: 0644]
include/linux/numa.h
mm/numa.c

index 7d7d97ad3cd5abc7f7aadcfa6bdbe152fd303ccf..4e350df9a02dd8de387b912740af69035da93e34 100644 (file)
@@ -9,6 +9,7 @@ syscall-y += unistd_compat_32.h
 
 generic-y += early_ioremap.h
 generic-y += mcs_spinlock.h
+generic-y += mmzone.h
 generic-y += qrwlock.h
 generic-y += qspinlock.h
 generic-y += parport.h
diff --git a/arch/arm64/include/asm/mmzone.h b/arch/arm64/include/asm/mmzone.h
deleted file mode 100644 (file)
index fa17e01..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef __ASM_MMZONE_H
-#define __ASM_MMZONE_H
-
-#ifdef CONFIG_NUMA
-
-#include <asm/numa.h>
-
-extern struct pglist_data *node_data[];
-#define NODE_DATA(nid)         (node_data[(nid)])
-
-#endif /* CONFIG_NUMA */
-#endif /* __ASM_MMZONE_H */
index 0f6ef432fb8403c9264f191e6f6102d3044a20c4..5fc3af9f8f29bc14a3f06d53ecd2407e9b5dbf51 100644 (file)
@@ -5,6 +5,7 @@
 #include <linux/cpumask.h>
 
 #ifdef CONFIG_NUMA
+#include <asm/numa.h>
 
 struct pci_bus;
 int pcibus_to_node(struct pci_bus *bus);
index 2bb3676429c05259f7cc61e0250f8dec04e66478..8fa22cc52774d8a4ccbf56f2000cbba9db490805 100644 (file)
@@ -9,5 +9,6 @@ generic-y += qrwlock.h
 generic-y += qspinlock.h
 generic-y += user.h
 generic-y += ioctl.h
+generic-y += mmzone.h
 generic-y += statfs.h
 generic-y += param.h
diff --git a/arch/loongarch/include/asm/mmzone.h b/arch/loongarch/include/asm/mmzone.h
deleted file mode 100644 (file)
index 2b9a907..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Author: Huacai Chen (chenhuacai@loongson.cn)
- * Copyright (C) 2020-2022 Loongson Technology Corporation Limited
- */
-#ifndef _ASM_MMZONE_H_
-#define _ASM_MMZONE_H_
-
-#include <asm/page.h>
-#include <asm/numa.h>
-
-extern struct pglist_data *node_data[];
-
-#define NODE_DATA(nid) (node_data[(nid)])
-
-#endif /* _ASM_MMZONE_H_ */
index 66128dec0bf6e090663a1029d65e3c50251df38d..50273c9187d020430008e31d2489a5c9978b62c1 100644 (file)
@@ -8,6 +8,7 @@
 #include <linux/smp.h>
 
 #ifdef CONFIG_NUMA
+#include <asm/numa.h>
 
 extern cpumask_t cpus_on_node[];
 
index 8fe21f868f72d4aa8c4b55be5937a037f514991d..acada671e020c841021c98da5948412f5f310484 100644 (file)
 #include <asm/time.h>
 
 int numa_off;
-struct pglist_data *node_data[MAX_NUMNODES];
 unsigned char node_distances[MAX_NUMNODES][MAX_NUMNODES];
-
-EXPORT_SYMBOL(node_data);
 EXPORT_SYMBOL(node_distances);
 
 static struct numa_meminfo numa_meminfo;
index 629c3f2902031fe8aff88d3337589dd0da6addee..56959eb9cb262cee745c37226c449e0c76db144d 100644 (file)
@@ -24,8 +24,4 @@ extern struct node_data *__node_data[];
 
 #define hub_data(n)            (&__node_data[(n)]->hub)
 
-extern struct pglist_data *node_data[];
-
-#define NODE_DATA(nid)         (node_data[nid])
-
 #endif /* _ASM_MACH_MMZONE_H */
index 2effd5f8ed62292019b3622f4b47ff12790a0bb2..8fb70fd3c9c4ad813364d93438359434412663a8 100644 (file)
 #define pa_to_nid(addr)  (((addr) & 0xf00000000000) >> NODE_ADDRSPACE_SHIFT)
 #define nid_to_addrbase(nid) ((unsigned long)(nid) << NODE_ADDRSPACE_SHIFT)
 
-extern struct pglist_data *node_data[];
-
-#define NODE_DATA(n)           (node_data[n])
-
 extern void __init prom_init_numa_memory(void);
 
 #endif /* _ASM_MACH_MMZONE_H */
index 64fcfaa885b65397cce117ad5898a556fe19295f..d562387457442f957147aa0b24d087a3bb492065 100644 (file)
@@ -29,8 +29,6 @@
 
 unsigned char __node_distances[MAX_NUMNODES][MAX_NUMNODES];
 EXPORT_SYMBOL(__node_distances);
-struct pglist_data *node_data[MAX_NUMNODES];
-EXPORT_SYMBOL(node_data);
 
 cpumask_t __node_cpumask[MAX_NUMNODES];
 EXPORT_SYMBOL(__node_cpumask);
index eb6d2fa41a8aa3c002b7fea2a6800b3ba79889e3..1963313f55d8a179c22353e83e77fc37394cef6c 100644 (file)
@@ -34,9 +34,6 @@
 #define SLOT_PFNSHIFT          (SLOT_SHIFT - PAGE_SHIFT)
 #define PFN_NASIDSHFT          (NASID_SHFT - PAGE_SHIFT)
 
-struct pglist_data *node_data[MAX_NUMNODES];
-EXPORT_SYMBOL(node_data);
-
 struct node_data *__node_data[MAX_NUMNODES];
 EXPORT_SYMBOL(__node_data);
 
index da827d2d08666e1ea33f4fe9346045c4fe4fa554..d99863cd6cde48b51242056562c1db4e535c0592 100644 (file)
 
 #ifdef CONFIG_NUMA
 
-extern struct pglist_data *node_data[];
-/*
- * Return a pointer to the node data for node n.
- */
-#define NODE_DATA(nid)         (node_data[nid])
-
 /*
  * Following are specific to this numa platform.
  */
index aa89899f0c1a1e98e0dac530e39d58bfe13551e0..0744a9a2944bf68e388a2fc5e3d4eff46cea327c 100644 (file)
@@ -43,11 +43,9 @@ static char *cmdline __initdata;
 
 int numa_cpu_lookup_table[NR_CPUS];
 cpumask_var_t node_to_cpumask_map[MAX_NUMNODES];
-struct pglist_data *node_data[MAX_NUMNODES];
 
 EXPORT_SYMBOL(numa_cpu_lookup_table);
 EXPORT_SYMBOL(node_to_cpumask_map);
-EXPORT_SYMBOL(node_data);
 
 static int primary_domain_index;
 static int n_mem_addr_cells, n_mem_size_cells;
index 5c589770f2a8232c793ca7bb8ff8dc3d570ff694..1461af12da6e2bbbff6cf737a7babf33bd298cdd 100644 (file)
@@ -5,6 +5,7 @@ syscall-y += syscall_table_64.h
 generic-y += early_ioremap.h
 generic-y += flat.h
 generic-y += kvm_para.h
+generic-y += mmzone.h
 generic-y += parport.h
 generic-y += spinlock.h
 generic-y += spinlock_types.h
diff --git a/arch/riscv/include/asm/mmzone.h b/arch/riscv/include/asm/mmzone.h
deleted file mode 100644 (file)
index fa17e01..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef __ASM_MMZONE_H
-#define __ASM_MMZONE_H
-
-#ifdef CONFIG_NUMA
-
-#include <asm/numa.h>
-
-extern struct pglist_data *node_data[];
-#define NODE_DATA(nid)         (node_data[(nid)])
-
-#endif /* CONFIG_NUMA */
-#endif /* __ASM_MMZONE_H */
index 61183688bdd54edf247a94d5c77258cd96d248b5..fe1a8bf6902d95cdf7bfc1c687b3f71409d3b4e5 100644 (file)
@@ -4,6 +4,10 @@
 
 #include <linux/arch_topology.h>
 
+#ifdef CONFIG_NUMA
+#include <asm/numa.h>
+#endif
+
 /* Replace task scheduler's default frequency-invariant accounting */
 #define arch_scale_freq_tick           topology_scale_freq_tick
 #define arch_set_freq_scale            topology_set_freq_scale
index 4b904110d27cb049358a41c184287356ae783f2f..297bf7157968907d6e4c4ff8b65deeef02dbd630 100644 (file)
@@ -7,3 +7,4 @@ generated-y += unistd_nr.h
 generic-y += asm-offsets.h
 generic-y += kvm_types.h
 generic-y += mcs_spinlock.h
+generic-y += mmzone.h
diff --git a/arch/s390/include/asm/mmzone.h b/arch/s390/include/asm/mmzone.h
deleted file mode 100644 (file)
index 73e3e7c..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * NUMA support for s390
- *
- * Copyright IBM Corp. 2015
- */
-
-#ifndef _ASM_S390_MMZONE_H
-#define _ASM_S390_MMZONE_H
-
-#ifdef CONFIG_NUMA
-
-extern struct pglist_data *node_data[];
-#define NODE_DATA(nid) (node_data[nid])
-
-#endif /* CONFIG_NUMA */
-#endif /* _ASM_S390_MMZONE_H */
index 23ab9f02f2787301ecfd6c4e93c674570f279873..ddc1448ea2e1126370a441b64705c523baa6deb5 100644 (file)
@@ -14,9 +14,6 @@
 #include <linux/node.h>
 #include <asm/numa.h>
 
-struct pglist_data *node_data[MAX_NUMNODES];
-EXPORT_SYMBOL(node_data);
-
 void __init numa_setup(void)
 {
        int nid;
index 7b8dead2723dc3ceee3b9b6a464f960e22f6d884..63f88b465e394503d70779bb279308bb9f0b1808 100644 (file)
@@ -5,9 +5,6 @@
 #ifdef CONFIG_NUMA
 #include <linux/numa.h>
 
-extern struct pglist_data *node_data[];
-#define NODE_DATA(nid)         (node_data[nid])
-
 static inline int pfn_to_nid(unsigned long pfn)
 {
        int nid;
index 50f0dc1744d049b9bac8aca01feafce889288fc1..9bc212b5e762a98bdb392ef0430628a050fdf383 100644 (file)
@@ -14,9 +14,6 @@
 #include <linux/pfn.h>
 #include <asm/sections.h>
 
-struct pglist_data *node_data[MAX_NUMNODES] __read_mostly;
-EXPORT_SYMBOL_GPL(node_data);
-
 /*
  * On SH machines the conventional approach is to stash system RAM
  * in node 0, and other memory blocks in to node 1 and up, ordered by
index a236d8aa893a9152e1c84935da3edb131c7827fe..74eb2c71d0774acf679708644bde36ae60c48b43 100644 (file)
@@ -6,10 +6,6 @@
 
 #include <linux/cpumask.h>
 
-extern struct pglist_data *node_data[];
-
-#define NODE_DATA(nid)         (node_data[nid])
-
 extern int numa_cpu_lookup_table[];
 extern cpumask_t numa_cpumask_lookup_table[];
 
index 53d7cb5bbffe5aaefd683f5c520690ec0cafa2ba..c6c7f43cb1e8ad7538a18b88f26da894dac11f33 100644 (file)
@@ -1115,11 +1115,9 @@ static void init_node_masks_nonnuma(void)
 }
 
 #ifdef CONFIG_NUMA
-struct pglist_data *node_data[MAX_NUMNODES];
 
 EXPORT_SYMBOL(numa_cpu_lookup_table);
 EXPORT_SYMBOL(numa_cpumask_lookup_table);
-EXPORT_SYMBOL(node_data);
 
 static int scan_pio_for_cfg_handle(struct mdesc_handle *md, u64 pio,
                                   u32 cfg_handle)
index a192bdea69e2e08c59f21adb793d9589374e8dfc..6c23d1661b1739cd3b9ac6eaee61b881f4a5b5f7 100644 (file)
@@ -11,3 +11,4 @@ generated-y += xen-hypercalls.h
 
 generic-y += early_ioremap.h
 generic-y += mcs_spinlock.h
+generic-y += mmzone.h
diff --git a/arch/x86/include/asm/mmzone.h b/arch/x86/include/asm/mmzone.h
deleted file mode 100644 (file)
index c41b41e..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifdef CONFIG_X86_32
-# include <asm/mmzone_32.h>
-#else
-# include <asm/mmzone_64.h>
-#endif
diff --git a/arch/x86/include/asm/mmzone_32.h b/arch/x86/include/asm/mmzone_32.h
deleted file mode 100644 (file)
index 2d4515e..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Written by Pat Gaughen (gone@us.ibm.com) Mar 2002
- *
- */
-
-#ifndef _ASM_X86_MMZONE_32_H
-#define _ASM_X86_MMZONE_32_H
-
-#include <asm/smp.h>
-
-#ifdef CONFIG_NUMA
-extern struct pglist_data *node_data[];
-#define NODE_DATA(nid) (node_data[nid])
-#endif /* CONFIG_NUMA */
-
-#endif /* _ASM_X86_MMZONE_32_H */
diff --git a/arch/x86/include/asm/mmzone_64.h b/arch/x86/include/asm/mmzone_64.h
deleted file mode 100644 (file)
index 0c58504..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/* K8 NUMA support */
-/* Copyright 2002,2003 by Andi Kleen, SuSE Labs */
-/* 2.5 Version loosely based on the NUMAQ Code by Pat Gaughen. */
-#ifndef _ASM_X86_MMZONE_64_H
-#define _ASM_X86_MMZONE_64_H
-
-#ifdef CONFIG_NUMA
-
-#include <linux/mmdebug.h>
-#include <asm/smp.h>
-
-extern struct pglist_data *node_data[];
-
-#define NODE_DATA(nid)         (node_data[nid])
-
-#endif
-#endif /* _ASM_X86_MMZONE_64_H */
index 6ce10e3c622858dc7c2cf0707dc6eabf0aa619e8..7de725d6bb05748c0d865a88faf52cf104a4f942 100644 (file)
@@ -24,9 +24,6 @@
 int numa_off;
 nodemask_t numa_nodes_parsed __initdata;
 
-struct pglist_data *node_data[MAX_NUMNODES] __read_mostly;
-EXPORT_SYMBOL(node_data);
-
 static struct numa_meminfo numa_meminfo __initdata_or_meminfo;
 static struct numa_meminfo numa_reserved_meminfo __initdata_or_meminfo;
 
index 555aee3ee8e7325e854785e28e39c5dbf91ad9ae..ceac5b59bf2ba2b64d10d27323748097831ea5ef 100644 (file)
@@ -15,8 +15,6 @@
 
 #include <asm/sections.h>
 
-struct pglist_data *node_data[MAX_NUMNODES] __read_mostly;
-EXPORT_SYMBOL(node_data);
 nodemask_t numa_nodes_parsed __initdata;
 static int cpu_to_node_map[NR_CPUS] = { [0 ... NR_CPUS-1] = NUMA_NO_NODE };
 
diff --git a/include/asm-generic/mmzone.h b/include/asm-generic/mmzone.h
new file mode 100644 (file)
index 0000000..2ab5193
--- /dev/null
@@ -0,0 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _ASM_GENERIC_MMZONE_H
+#define _ASM_GENERIC_MMZONE_H
+
+#endif
index eb19503604fe365e7f35bb42580649a380bd13d7..e5841d4057ab655fb7227bbe6c84fa2f11e4e265 100644 (file)
@@ -30,6 +30,9 @@ static inline bool numa_valid_node(int nid)
 #ifdef CONFIG_NUMA
 #include <asm/sparsemem.h>
 
+extern struct pglist_data *node_data[];
+#define NODE_DATA(nid) (node_data[nid])
+
 /* Generic implementation available */
 int numa_nearest_node(int node, unsigned int state);
 
index 67ca6b8585c06f59cc8a849c7128f5d83fbf781a..8c157d41c026e23032e7259d81dda99e9b1769a8 100644 (file)
--- a/mm/numa.c
+++ b/mm/numa.c
@@ -3,6 +3,9 @@
 #include <linux/printk.h>
 #include <linux/numa.h>
 
+struct pglist_data *node_data[MAX_NUMNODES];
+EXPORT_SYMBOL(node_data);
+
 /* Stub functions: */
 
 #ifndef memory_add_physaddr_to_nid