mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/9] treewide, numa_memblks: remove redundant work during NUMA init
@ 2026-06-28 13:58 Sang-Heon Jeon
  2026-06-28 14:18 ` [PATCH 4/9] x86/numa: remove redundant numa_nodes_parsed node_set() Sang-Heon Jeon
  2026-07-02 10:39 ` [PATCH 0/9] treewide, numa_memblks: remove redundant work during NUMA init Mike Rapoport
  0 siblings, 2 replies; 3+ messages in thread
From: Sang-Heon Jeon @ 2026-06-28 13:58 UTC (permalink / raw)
  To: Andrew Morton, Andy Lutomirski, Borislav Petkov,
	Danilo Krummrich, Dave Hansen, Greg Kroah-Hartman, Huacai Chen,
	Ingo Molnar, Mike Rapoport, Peter Zijlstra, Rafael J. Wysocki,
	Rob Herring, Saravana Kannan, Thomas Gleixner
  Cc: Sang-Heon Jeon, devicetree, driver-core, H. Peter Anvin,
	Len Brown, linux-acpi, linux-mm, loongarch, WANG Xuerui, x86,
	linux-kernel

Every existing numa_add_memblk() caller passes a valid node id and
separately marks that node in numa_nodes_parsed with node_set(). In
addition, numa_nodemask_from_meminfo() recomputes the same "nodes that own
memory" set from numa_meminfo, which numa_nodes_parsed already contains.

This redundancy implicitly depends on the callers' node_set(). So, before
removing the redundancy, make numa_add_memblk() set the node in
numa_nodes_parsed explicitly. Then remove the per-caller node_set() and
numa_nodemask_from_meminfo().

Also, since the generic numa_register_meminfo() already sets
node_possible_map to numa_nodes_parsed, remove the duplicate assignment in
arch_numa's numa_register_nodes().

Patch 1 adds the node_set() to numa_add_memblk() itself, so every memblk's
node is set in numa_nodes_parsed on add.

Patches 2-6 depend on patch 1 and remove the redundant per-caller node_set()
from all callers.

Patch 7 removes both numa_nodemask_from_meminfo() call sites and the unused
function itself.

Patch 8 removes the duplicate node_possible_map assignment in arch_numa.

Patch 9 is a minor cleanup, using the existing numa_add_reserved_memblk()
wrapper in numa_cleanup_meminfo().

No functional change.

Sang-Heon Jeon (9):
  mm: numa_memblks: set numa_nodes_parsed in numa_add_memblk()
  ACPI: NUMA: remove redundant numa_nodes_parsed node_set()
  of/numa: remove redundant numa_nodes_parsed node_set()
  x86/numa: remove redundant numa_nodes_parsed node_set()
  arch_numa: remove redundant numa_nodes_parsed node_set()
  LoongArch: remove redundant numa_nodes_parsed node_set()
  mm: numa_memblks: remove redundant numa_nodemask_from_meminfo()
  arch_numa: remove redundant node_possible_map assignment
  mm: numa_memblks: use numa_add_reserved_memblk() in
    numa_cleanup_meminfo()

 arch/loongarch/kernel/numa.c |  1 -
 arch/x86/mm/amdtopology.c    |  1 -
 arch/x86/mm/numa.c           |  1 -
 drivers/acpi/numa/srat.c     |  2 --
 drivers/base/arch_numa.c     |  4 ----
 drivers/of/of_numa.c         |  5 +----
 mm/numa_memblks.c            | 41 +++++++++++++++---------------------
 7 files changed, 18 insertions(+), 37 deletions(-)

-- 
2.43.0


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

* [PATCH 4/9] x86/numa: remove redundant numa_nodes_parsed node_set()
  2026-06-28 13:58 [PATCH 0/9] treewide, numa_memblks: remove redundant work during NUMA init Sang-Heon Jeon
@ 2026-06-28 14:18 ` Sang-Heon Jeon
  2026-07-02 10:39 ` [PATCH 0/9] treewide, numa_memblks: remove redundant work during NUMA init Mike Rapoport
  1 sibling, 0 replies; 3+ messages in thread
From: Sang-Heon Jeon @ 2026-06-28 14:18 UTC (permalink / raw)
  To: Dave Hansen, Andy Lutomirski, Peter Zijlstra, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov
  Cc: Sang-Heon Jeon, H. Peter Anvin, linux-kernel, x86

numa_add_memblk() now sets the node in numa_nodes_parsed itself, so the
caller's own node_set() is redundant. Remove it.

No functional change.

Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
---
 arch/x86/mm/amdtopology.c | 1 -
 arch/x86/mm/numa.c        | 1 -
 2 files changed, 2 deletions(-)

diff --git a/arch/x86/mm/amdtopology.c b/arch/x86/mm/amdtopology.c
index f980b0eb0105..1cb581bbf2b6 100644
--- a/arch/x86/mm/amdtopology.c
+++ b/arch/x86/mm/amdtopology.c
@@ -150,7 +150,6 @@ int __init amd_numa_init(void)
 
 		prevbase = base;
 		numa_add_memblk(nodeid, base, limit);
-		node_set(nodeid, numa_nodes_parsed);
 	}
 
 	if (nodes_empty(numa_nodes_parsed))
diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c
index 99d0a9332c14..ced66e68a68e 100644
--- a/arch/x86/mm/numa.c
+++ b/arch/x86/mm/numa.c
@@ -216,7 +216,6 @@ static int __init dummy_numa_init(void)
 	printk(KERN_INFO "Faking a node at [mem %#018Lx-%#018Lx]\n",
 	       0LLU, PFN_PHYS(max_pfn) - 1);
 
-	node_set(0, numa_nodes_parsed);
 	node_set(0, numa_phys_nodes_parsed);
 	numa_add_memblk(0, 0, PFN_PHYS(max_pfn));
 
-- 
2.43.0


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

* Re: [PATCH 0/9] treewide, numa_memblks: remove redundant work during NUMA init
  2026-06-28 13:58 [PATCH 0/9] treewide, numa_memblks: remove redundant work during NUMA init Sang-Heon Jeon
  2026-06-28 14:18 ` [PATCH 4/9] x86/numa: remove redundant numa_nodes_parsed node_set() Sang-Heon Jeon
@ 2026-07-02 10:39 ` Mike Rapoport
  1 sibling, 0 replies; 3+ messages in thread
From: Mike Rapoport @ 2026-07-02 10:39 UTC (permalink / raw)
  To: Sang-Heon Jeon
  Cc: Andrew Morton, Andy Lutomirski, Borislav Petkov,
	Danilo Krummrich, Dave Hansen, Greg Kroah-Hartman, Huacai Chen,
	Ingo Molnar, Mike Rapoport, Peter Zijlstra, Rafael J. Wysocki,
	Rob Herring, Saravana Kannan, Thomas Gleixner, devicetree,
	driver-core, H. Peter Anvin, Len Brown, linux-acpi, linux-mm,
	loongarch, WANG Xuerui, x86, linux-kernel

Hi,

> Every existing numa_add_memblk() caller passes a valid node id and
> separately marks that node in numa_nodes_parsed with node_set(). In
> addition, numa_nodemask_from_meminfo() recomputes the same "nodes that own
> memory" set from numa_meminfo, which numa_nodes_parsed already contains.
> 
> This redundancy implicitly depends on the callers' node_set(). So, before
> removing the redundancy, make numa_add_memblk() set the node in
> numa_nodes_parsed explicitly. Then remove the per-caller node_set() and
> numa_nodemask_from_meminfo().
> 
> Also, since the generic numa_register_meminfo() already sets
> node_possible_map to numa_nodes_parsed, remove the duplicate assignment in
> arch_numa's numa_register_nodes().
> 
> Patch 1 adds the node_set() to numa_add_memblk() itself, so every memblk's
> node is set in numa_nodes_parsed on add.
> 
> Patches 2-6 depend on patch 1 and remove the redundant per-caller node_set()
> from all callers.
> 
> Patch 7 removes both numa_nodemask_from_meminfo() call sites and the unused
> function itself.
> 
> Patch 8 removes the duplicate node_possible_map assignment in arch_numa.
> 
> Patch 9 is a minor cleanup, using the existing numa_add_reserved_memblk()
> wrapper in numa_cleanup_meminfo().
> 
> No functional change.

Looks good to me.

Can you please address the small comment for patch 1?

-- 
Sincerely yours,
Mike.


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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-28 13:58 [PATCH 0/9] treewide, numa_memblks: remove redundant work during NUMA init Sang-Heon Jeon
2026-06-28 14:18 ` [PATCH 4/9] x86/numa: remove redundant numa_nodes_parsed node_set() Sang-Heon Jeon
2026-07-02 10:39 ` [PATCH 0/9] treewide, numa_memblks: remove redundant work during NUMA init Mike Rapoport

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

all inboxes | Powered by JetHome®