Commit 317ef459 authored by Mike Rapoport (Microsoft)'s avatar Mike Rapoport (Microsoft) Committed by Andrew Morton

mm: numa_memblks: make several functions and variables static

Make functions and variables that are exclusively used by numa_memblks
static.

Move numa_nodemask_from_meminfo() before its callers to avoid forward
declaration.

Link: https://lkml.kernel.org/r/20240807064110.1003856-22-rppt@kernel.orgSigned-off-by: default avatarMike Rapoport (Microsoft) <rppt@kernel.org>
Tested-by: Zi Yan <ziy@nvidia.com> # for x86_64 and arm64
Reviewed-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
Tested-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> [arm64 + CXL via QEMU]
Acked-by: default avatarDan Williams <dan.j.williams@intel.com>
Acked-by: default avatarDavid Hildenbrand <david@redhat.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: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 692d73d2
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#define NR_NODE_MEMBLKS (MAX_NUMNODES * 2) #define NR_NODE_MEMBLKS (MAX_NUMNODES * 2)
extern int numa_distance_cnt;
void __init numa_set_distance(int from, int to, int distance); void __init numa_set_distance(int from, int to, int distance);
void __init numa_reset_distance(void); void __init numa_reset_distance(void);
...@@ -22,17 +21,10 @@ struct numa_meminfo { ...@@ -22,17 +21,10 @@ struct numa_meminfo {
struct numa_memblk blk[NR_NODE_MEMBLKS]; struct numa_memblk blk[NR_NODE_MEMBLKS];
}; };
extern struct numa_meminfo numa_meminfo __initdata_or_meminfo;
extern struct numa_meminfo numa_reserved_meminfo __initdata_or_meminfo;
int __init numa_add_memblk(int nodeid, u64 start, u64 end); int __init numa_add_memblk(int nodeid, u64 start, u64 end);
void __init numa_remove_memblk_from(int idx, struct numa_meminfo *mi); void __init numa_remove_memblk_from(int idx, struct numa_meminfo *mi);
int __init numa_cleanup_meminfo(struct numa_meminfo *mi); int __init numa_cleanup_meminfo(struct numa_meminfo *mi);
int __init numa_register_meminfo(struct numa_meminfo *mi);
void __init numa_nodemask_from_meminfo(nodemask_t *nodemask,
const struct numa_meminfo *mi);
int __init numa_memblks_init(int (*init_func)(void), int __init numa_memblks_init(int (*init_func)(void),
bool memblock_force_top_down); bool memblock_force_top_down);
......
...@@ -7,13 +7,27 @@ ...@@ -7,13 +7,27 @@
#include <linux/numa.h> #include <linux/numa.h>
#include <linux/numa_memblks.h> #include <linux/numa_memblks.h>
int numa_distance_cnt; static int numa_distance_cnt;
static u8 *numa_distance; static u8 *numa_distance;
nodemask_t numa_nodes_parsed __initdata; nodemask_t numa_nodes_parsed __initdata;
struct numa_meminfo numa_meminfo __initdata_or_meminfo; static struct numa_meminfo numa_meminfo __initdata_or_meminfo;
struct numa_meminfo numa_reserved_meminfo __initdata_or_meminfo; static struct numa_meminfo numa_reserved_meminfo __initdata_or_meminfo;
/*
* Set nodes, which have memory in @mi, in *@nodemask.
*/
static void __init numa_nodemask_from_meminfo(nodemask_t *nodemask,
const struct numa_meminfo *mi)
{
int i;
for (i = 0; i < ARRAY_SIZE(mi->blk); i++)
if (mi->blk[i].start != mi->blk[i].end &&
mi->blk[i].nid != NUMA_NO_NODE)
node_set(mi->blk[i].nid, *nodemask);
}
/** /**
* numa_reset_distance - Reset NUMA distance table * numa_reset_distance - Reset NUMA distance table
...@@ -290,20 +304,6 @@ int __init numa_cleanup_meminfo(struct numa_meminfo *mi) ...@@ -290,20 +304,6 @@ int __init numa_cleanup_meminfo(struct numa_meminfo *mi)
return 0; return 0;
} }
/*
* Set nodes, which have memory in @mi, in *@nodemask.
*/
void __init numa_nodemask_from_meminfo(nodemask_t *nodemask,
const struct numa_meminfo *mi)
{
int i;
for (i = 0; i < ARRAY_SIZE(mi->blk); i++)
if (mi->blk[i].start != mi->blk[i].end &&
mi->blk[i].nid != NUMA_NO_NODE)
node_set(mi->blk[i].nid, *nodemask);
}
/* /*
* Mark all currently memblock-reserved physical memory (which covers the * Mark all currently memblock-reserved physical memory (which covers the
* kernel's own memory ranges) as hot-unswappable. * kernel's own memory ranges) as hot-unswappable.
...@@ -371,7 +371,7 @@ static void __init numa_clear_kernel_node_hotplug(void) ...@@ -371,7 +371,7 @@ static void __init numa_clear_kernel_node_hotplug(void)
} }
} }
int __init numa_register_meminfo(struct numa_meminfo *mi) static int __init numa_register_meminfo(struct numa_meminfo *mi)
{ {
int i; int i;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment