* [PATCH 1/4] sparc64: set node_possible_map in bootmem_init_numa()
2026-07-01 17:18 [PATCH 0/4] treewide, mm: initialize node_possible_map like the other node maps Sang-Heon Jeon
@ 2026-07-01 17:18 ` Sang-Heon Jeon
2026-07-01 17:18 ` [PATCH 2/4] sh: set node_possible_map in do_init_bootmem() Sang-Heon Jeon
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Sang-Heon Jeon @ 2026-07-01 17:18 UTC (permalink / raw)
To: akpm, David S. Miller, Andreas Larsson
Cc: linux-mm, Sang-Heon Jeon, John Paul Adrian Glaubitz, linux-kernel,
Madhavan Srinivasan, Michael Ellerman, Rich Felker, sparclinux,
Vlastimil Babka, Yoshinori Sato, Yury Norov
Unlike other NUMA architectures, sparc64 never sets node_possible_map.
bootmem_init_numa() marks all nodes online and node_online_map does not
change afterwards, so set node_possible_map from node_online_map.
Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
---
arch/sparc/mm/init_64.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
index 103db4683b16..a749f63568b7 100644
--- a/arch/sparc/mm/init_64.c
+++ b/arch/sparc/mm/init_64.c
@@ -1559,6 +1559,8 @@ static int __init bootmem_init_numa(void)
else
err = numa_parse_sun4u();
}
+ if (!err)
+ node_possible_map = node_online_map;
return err;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 2/4] sh: set node_possible_map in do_init_bootmem()
2026-07-01 17:18 [PATCH 0/4] treewide, mm: initialize node_possible_map like the other node maps Sang-Heon Jeon
2026-07-01 17:18 ` [PATCH 1/4] sparc64: set node_possible_map in bootmem_init_numa() Sang-Heon Jeon
@ 2026-07-01 17:18 ` Sang-Heon Jeon
2026-07-01 17:18 ` [PATCH 3/4] powerpc/numa: set node_possible_map from node_online_map Sang-Heon Jeon
2026-07-01 17:18 ` [PATCH 4/4] mm/page_alloc: initialize node_possible_map like the other node maps Sang-Heon Jeon
3 siblings, 0 replies; 5+ messages in thread
From: Sang-Heon Jeon @ 2026-07-01 17:18 UTC (permalink / raw)
To: akpm, Yoshinori Sato, Rich Felker, John Paul Adrian Glaubitz
Cc: linux-mm, Sang-Heon Jeon, Andreas Larsson, David S. Miller,
linux-kernel, linux-sh, Madhavan Srinivasan, Michael Ellerman,
Vlastimil Babka, Yury Norov
Unlike other NUMA architectures, sh never sets node_possible_map.
do_init_bootmem() marks node 0 online and plat_mem_setup() marks the
rest online, after which node_online_map does not change, so set
node_possible_map from node_online_map.
Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
---
arch/sh/mm/init.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c
index 110308bdef01..13954d7bbdae 100644
--- a/arch/sh/mm/init.c
+++ b/arch/sh/mm/init.c
@@ -227,6 +227,8 @@ static void __init do_init_bootmem(void)
node_set_online(0);
plat_mem_setup();
+
+ node_possible_map = node_online_map;
}
static void __init early_reserve_mem(void)
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/4] powerpc/numa: set node_possible_map from node_online_map
2026-07-01 17:18 [PATCH 0/4] treewide, mm: initialize node_possible_map like the other node maps Sang-Heon Jeon
2026-07-01 17:18 ` [PATCH 1/4] sparc64: set node_possible_map in bootmem_init_numa() Sang-Heon Jeon
2026-07-01 17:18 ` [PATCH 2/4] sh: set node_possible_map in do_init_bootmem() Sang-Heon Jeon
@ 2026-07-01 17:18 ` Sang-Heon Jeon
2026-07-01 17:18 ` [PATCH 4/4] mm/page_alloc: initialize node_possible_map like the other node maps Sang-Heon Jeon
3 siblings, 0 replies; 5+ messages in thread
From: Sang-Heon Jeon @ 2026-07-01 17:18 UTC (permalink / raw)
To: akpm, Madhavan Srinivasan, Michael Ellerman
Cc: linux-mm, Sang-Heon Jeon, Andreas Larsson,
Christophe Leroy (CS GROUP), David S. Miller,
John Paul Adrian Glaubitz, linux-kernel, linuxppc-dev,
Nicholas Piggin, Rich Felker, Vlastimil Babka, Yoshinori Sato,
Yury Norov
mem_topology_setup() intersects node_possible_map with node_online_map.
Nothing sets node_possible_map before this, so it is NODE_MASK_ALL and
the result is just node_online_map.
In preparation for changing node_possible_map's initial value,
mem_topology_setup() no longer depends on it.
No functional change.
Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
---
arch/powerpc/mm/numa.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index f4cf3ae036de..2fdecae90a01 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -1179,7 +1179,7 @@ void __init mem_topology_setup(void)
* that we expect to make use of for this platform's affinity
* calculations.
*/
- nodes_and(node_possible_map, node_possible_map, node_online_map);
+ node_possible_map = node_online_map;
find_possible_nodes();
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 4/4] mm/page_alloc: initialize node_possible_map like the other node maps
2026-07-01 17:18 [PATCH 0/4] treewide, mm: initialize node_possible_map like the other node maps Sang-Heon Jeon
` (2 preceding siblings ...)
2026-07-01 17:18 ` [PATCH 3/4] powerpc/numa: set node_possible_map from node_online_map Sang-Heon Jeon
@ 2026-07-01 17:18 ` Sang-Heon Jeon
3 siblings, 0 replies; 5+ messages in thread
From: Sang-Heon Jeon @ 2026-07-01 17:18 UTC (permalink / raw)
To: akpm, Yury Norov, Vlastimil Babka
Cc: linux-mm, Sang-Heon Jeon, Andreas Larsson, Brendan Jackman,
David S. Miller, Johannes Weiner, John Paul Adrian Glaubitz,
linux-kernel, Madhavan Srinivasan, Michael Ellerman, Michal Hocko,
Rasmus Villemoes, Rich Felker, Suren Baghdasaryan, Yoshinori Sato,
Zi Yan
node_states[N_POSSIBLE], aliased by node_possible_map, is initialized to
NODE_MASK_ALL, unlike the other entries, which are initialized with only
node 0 set.
On !NUMA, MAX_NUMNODES == 1, so initializing node_possible_map to
NODE_MASK_ALL is equivalent to initializing it with only node 0 set.
On NUMA, every architecture now sets node_possible_map after parsing its
NUMA topology, so nothing relies on the initial value.
So, instead of initializing node_possible_map to NODE_MASK_ALL, set only
node 0, like the other entries. Then NODE_MASK_ALL is no longer used, so
remove it and its only helper NODE_MASK_LAST_WORD.
No functional change.
Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
---
include/linux/nodemask.h | 20 --------------------
mm/page_alloc.c | 2 +-
2 files changed, 1 insertion(+), 21 deletions(-)
diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h
index b842aa525546..484fe366a94c 100644
--- a/include/linux/nodemask.h
+++ b/include/linux/nodemask.h
@@ -47,7 +47,6 @@
* MAX_NUMNODES
*
* nodemask_t nodemask_of_node(node) Return nodemask with bit 'node' set
- * NODE_MASK_ALL Initializer - all bits set
* NODE_MASK_NONE Initializer - no bits set
* unsigned long *nodes_addr(mask) Array of unsigned long's in mask
*
@@ -296,25 +295,6 @@ static __always_inline unsigned int __first_unset_node(const nodemask_t *maskp)
return min(MAX_NUMNODES, find_first_zero_bit(maskp->bits, MAX_NUMNODES));
}
-#define NODE_MASK_LAST_WORD BITMAP_LAST_WORD_MASK(MAX_NUMNODES)
-
-#if MAX_NUMNODES <= BITS_PER_LONG
-
-#define NODE_MASK_ALL \
-((nodemask_t) { { \
- [BITS_TO_LONGS(MAX_NUMNODES)-1] = NODE_MASK_LAST_WORD \
-} })
-
-#else
-
-#define NODE_MASK_ALL \
-((nodemask_t) { { \
- [0 ... BITS_TO_LONGS(MAX_NUMNODES)-2] = ~0UL, \
- [BITS_TO_LONGS(MAX_NUMNODES)-1] = NODE_MASK_LAST_WORD \
-} })
-
-#endif
-
#define NODE_MASK_NONE \
((nodemask_t) { { \
[0 ... BITS_TO_LONGS(MAX_NUMNODES)-1] = 0UL \
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 784a6e2f8ba0..c0f17dede824 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -191,7 +191,7 @@ EXPORT_SYMBOL(latent_entropy);
* Array of node states.
*/
nodemask_t node_states[NR_NODE_STATES] __read_mostly = {
- [N_POSSIBLE] = NODE_MASK_ALL,
+ [N_POSSIBLE] = { { [0] = 1UL } },
[N_ONLINE] = { { [0] = 1UL } },
#ifndef CONFIG_NUMA
[N_NORMAL_MEMORY] = { { [0] = 1UL } },
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread