LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] treewide, mm: initialize node_possible_map like the other node maps
@ 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
  0 siblings, 1 reply; 5+ messages in thread
From: Sang-Heon Jeon @ 2026-07-01 17:18 UTC (permalink / raw)
  To: akpm, Andreas Larsson, David S. Miller, John Paul Adrian Glaubitz,
	Madhavan Srinivasan, Michael Ellerman, Rich Felker,
	Vlastimil Babka, Yoshinori Sato, Yury Norov
  Cc: linux-mm, Sang-Heon Jeon, Brendan Jackman,
	Christophe Leroy (CS GROUP), Johannes Weiner, linux-kernel,
	linuxppc-dev, linux-sh, Michal Hocko, Nicholas Piggin,
	Rasmus Villemoes, sparclinux, Suren Baghdasaryan, Zi Yan

While reviewing an earlier series [1], Andrew asked why we carefully
initialize node_possible_map at compile time, then zero it within __init
code anyway.

node_possible_map, aliased by node_states[N_POSSIBLE], is initialized to
NODE_MASK_ALL at compile time, unlike the other entries, which are
initialized with only node 0 set.

Architectures that use numa_memblks set node_possible_map from
numa_nodes_parsed, so the compile-time value is meaningless for them.

However, a few architectures that do not use numa_memblks do not set
node_possible_map on their own. Once these architectures set
node_possible_map to match their own topology, the NODE_MASK_ALL
initialization can be removed.

Patches 1-2 handle sparc64 and sh, which do not set node_possible_map
themselves. Both set node_online_map from their topology, so set
node_possible_map from node_online_map.

Patch 3 handles powerpc, which sets node_possible_map by intersecting it
with node_online_map. Nothing sets node_possible_map before this, so it is
still NODE_MASK_ALL and the intersection is just node_online_map. Once
patch 4 changes that initial value, the intersection would no longer be
node_online_map, so assign node_online_map directly.

Patch 4 initializes node_possible_map with only node 0 set, like the other
node_states[] entries. NODE_MASK_ALL is then no longer used, so remove it
and its only helper NODE_MASK_LAST_WORD.

[1] https://lore.kernel.org/all/20260624204030.3c8baa67713b6ca1d537baba@linux-foundation.org/

Sang-Heon Jeon (4):
  sparc64: set node_possible_map in bootmem_init_numa()
  sh: set node_possible_map in do_init_bootmem()
  powerpc/numa: set node_possible_map from node_online_map
  mm/page_alloc: initialize node_possible_map like the other node maps

 arch/powerpc/mm/numa.c   |  2 +-
 arch/sh/mm/init.c        |  2 ++
 arch/sparc/mm/init_64.c  |  2 ++
 include/linux/nodemask.h | 20 --------------------
 mm/page_alloc.c          |  2 +-
 5 files changed, 6 insertions(+), 22 deletions(-)

-- 
2.43.0



^ permalink raw reply	[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 ` Sang-Heon Jeon
  2026-07-01 20:55   ` Yury Norov
  0 siblings, 1 reply; 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

* Re: [PATCH 3/4] powerpc/numa: set node_possible_map from node_online_map
  2026-07-01 17:18 ` [PATCH 3/4] powerpc/numa: set node_possible_map from node_online_map Sang-Heon Jeon
@ 2026-07-01 20:55   ` Yury Norov
  2026-07-02  3:57     ` Sang-Heon Jeon
  0 siblings, 1 reply; 5+ messages in thread
From: Yury Norov @ 2026-07-01 20:55 UTC (permalink / raw)
  To: Sang-Heon Jeon
  Cc: akpm, Madhavan Srinivasan, Michael Ellerman, linux-mm,
	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

On Thu, Jul 02, 2026 at 02:18:50AM +0900, Sang-Heon Jeon wrote:
> 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();

And in find_possible_nodes():

         for (i = 0; i < max_nodes; i++) {
                 if (!node_possible(i))
                         node_set(i, node_possible_map);
         }

So, assuming the code reaches to that point, you unconditionally
online all the offlined nodes.

This doesn't look correct at the first glance, and definitely it's not
a "No functional change" type of things.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 3/4] powerpc/numa: set node_possible_map from node_online_map
  2026-07-01 20:55   ` Yury Norov
@ 2026-07-02  3:57     ` Sang-Heon Jeon
  2026-07-02  6:35       ` Yury Norov
  0 siblings, 1 reply; 5+ messages in thread
From: Sang-Heon Jeon @ 2026-07-02  3:57 UTC (permalink / raw)
  To: Yury Norov
  Cc: akpm, Madhavan Srinivasan, Michael Ellerman, linux-mm,
	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

Hi Yury,

On Thu, Jul 2, 2026 at 5:55 AM Yury Norov <yury.norov@gmail.com> wrote:
>
> On Thu, Jul 02, 2026 at 02:18:50AM +0900, Sang-Heon Jeon wrote:
> > 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();
>
> And in find_possible_nodes():
>
>          for (i = 0; i < max_nodes; i++) {
>                  if (!node_possible(i))
>                          node_set(i, node_possible_map);
>          }
>
> So, assuming the code reaches to that point, you unconditionally
> online all the offlined nodes.

This loop only sets bits in node_possible_map, not in node_online_map,
so I can't find how it onlines the offlined nodes unexpectedly. Please
correct me if I'm wrong or missing something.

Or are you talking about the case where max_nodes exceeds
MAX_NUMNODES, which was also noticed by sashiko? I think it is a
pre-existing issue, and this patch does not affect it.

> This doesn't look correct at the first glance, and definitely it's not
> a "No functional change" type of things.

Best Regards,
Sang-Heon Jeon


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 3/4] powerpc/numa: set node_possible_map from node_online_map
  2026-07-02  3:57     ` Sang-Heon Jeon
@ 2026-07-02  6:35       ` Yury Norov
  0 siblings, 0 replies; 5+ messages in thread
From: Yury Norov @ 2026-07-02  6:35 UTC (permalink / raw)
  To: Sang-Heon Jeon
  Cc: Yury Norov, akpm, Madhavan Srinivasan, Michael Ellerman, linux-mm,
	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

On Thu, Jul 02, 2026 at 12:57:46PM +0900, Sang-Heon Jeon wrote:
> Hi Yury,
> 
> On Thu, Jul 2, 2026 at 5:55 AM Yury Norov <yury.norov@gmail.com> wrote:
> >
> > On Thu, Jul 02, 2026 at 02:18:50AM +0900, Sang-Heon Jeon wrote:
> > > 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();
> >
> > And in find_possible_nodes():
> >
> >          for (i = 0; i < max_nodes; i++) {
> >                  if (!node_possible(i))
> >                          node_set(i, node_possible_map);
> >          }
> >
> > So, assuming the code reaches to that point, you unconditionally
> > online all the offlined nodes.
> 
> This loop only sets bits in node_possible_map, not in node_online_map,
> so I can't find how it onlines the offlined nodes unexpectedly. Please
> correct me if I'm wrong or missing something.
> 
> Or are you talking about the case where max_nodes exceeds
> MAX_NUMNODES, which was also noticed by sashiko? I think it is a
> pre-existing issue, and this patch does not affect it.

Oops, sorry, It's my bad. They are nodemask_t, not pointers, so in
"node_possible_map = node_online_map" you copy by value.

Thanks,
Yury


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-07-02  6:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 3/4] powerpc/numa: set node_possible_map from node_online_map Sang-Heon Jeon
2026-07-01 20:55   ` Yury Norov
2026-07-02  3:57     ` Sang-Heon Jeon
2026-07-02  6:35       ` Yury Norov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox