Linux driver-core infrastructure
 help / color / mirror / Atom feed
* [PATCH v2 0/9] treewide, numa_memblks: remove redundant work during NUMA init
@ 2026-07-03  4:13 Sang-Heon Jeon
  2026-07-03  4:13 ` [PATCH v2 5/9] arch_numa: remove redundant numa_nodes_parsed node_set() Sang-Heon Jeon
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Sang-Heon Jeon @ 2026-07-03  4:13 UTC (permalink / raw)
  To: rppt, akpm, Andy Lutomirski, Borislav Petkov, Danilo Krummrich,
	Dave Hansen, Greg Kroah-Hartman, Huacai Chen, Ingo Molnar,
	Peter Zijlstra, Rafael J. Wysocki, Rob Herring, Saravana Kannan,
	Thomas Gleixner
  Cc: linux-mm, Sang-Heon Jeon, devicetree, driver-core, H. Peter Anvin,
	Len Brown, linux-acpi, linux-kernel, loongarch, WANG Xuerui, x86

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.

---
Changes from v1 [1]
- remove warning in numa_add_memblk_to() when start == end
- add Acked-by tag
- rebased onto latest mm-new

[1] https://lore.kernel.org/all/20260628135828.1393120-1-ekffu200098@gmail.com/
--- 

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            | 39 +++++++++++++++++-------------------
 7 files changed, 19 insertions(+), 34 deletions(-)

-- 
2.43.0


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

* [PATCH v2 5/9] arch_numa: remove redundant numa_nodes_parsed node_set()
  2026-07-03  4:13 [PATCH v2 0/9] treewide, numa_memblks: remove redundant work during NUMA init Sang-Heon Jeon
@ 2026-07-03  4:13 ` Sang-Heon Jeon
  2026-07-03  4:13 ` [PATCH v2 8/9] arch_numa: remove redundant node_possible_map assignment Sang-Heon Jeon
  2026-07-03  9:43 ` [PATCH v2 0/9] treewide, numa_memblks: remove redundant work during NUMA init Mike Rapoport
  2 siblings, 0 replies; 4+ messages in thread
From: Sang-Heon Jeon @ 2026-07-03  4:13 UTC (permalink / raw)
  To: rppt, akpm, Greg Kroah-Hartman, Rafael J. Wysocki,
	Danilo Krummrich
  Cc: linux-mm, Sang-Heon Jeon, Andy Lutomirski, Borislav Petkov,
	Dave Hansen, driver-core, Huacai Chen, Ingo Molnar, linux-kernel,
	Peter Zijlstra, Rob Herring, Saravana Kannan, Thomas Gleixner

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>
---
 drivers/base/arch_numa.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/base/arch_numa.c b/drivers/base/arch_numa.c
index 442ea239bba7..c7f63c4cf367 100644
--- a/drivers/base/arch_numa.c
+++ b/drivers/base/arch_numa.c
@@ -279,7 +279,6 @@ static int __init dummy_numa_init(void)
 		pr_err("NUMA init failed\n");
 		return ret;
 	}
-	node_set(0, numa_nodes_parsed);
 
 	numa_off = true;
 	return 0;
-- 
2.43.0


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

* [PATCH v2 8/9] arch_numa: remove redundant node_possible_map assignment
  2026-07-03  4:13 [PATCH v2 0/9] treewide, numa_memblks: remove redundant work during NUMA init Sang-Heon Jeon
  2026-07-03  4:13 ` [PATCH v2 5/9] arch_numa: remove redundant numa_nodes_parsed node_set() Sang-Heon Jeon
@ 2026-07-03  4:13 ` Sang-Heon Jeon
  2026-07-03  9:43 ` [PATCH v2 0/9] treewide, numa_memblks: remove redundant work during NUMA init Mike Rapoport
  2 siblings, 0 replies; 4+ messages in thread
From: Sang-Heon Jeon @ 2026-07-03  4:13 UTC (permalink / raw)
  To: rppt, akpm, Greg Kroah-Hartman, Rafael J. Wysocki,
	Danilo Krummrich
  Cc: linux-mm, Sang-Heon Jeon, Andy Lutomirski, Borislav Petkov,
	Dave Hansen, driver-core, Huacai Chen, Ingo Molnar, linux-kernel,
	Peter Zijlstra, Rob Herring, Saravana Kannan, Thomas Gleixner

numa_register_meminfo() sets node_possible_map to numa_nodes_parsed.  The
later assignment in numa_register_nodes() is therefore redundant, so remove
it.

No functional change.

Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
---
 drivers/base/arch_numa.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/base/arch_numa.c b/drivers/base/arch_numa.c
index c7f63c4cf367..6476227b772c 100644
--- a/drivers/base/arch_numa.c
+++ b/drivers/base/arch_numa.c
@@ -221,9 +221,6 @@ static int __init numa_register_nodes(void)
 		node_set_online(nid);
 	}
 
-	/* Setup online nodes to actual nodes*/
-	node_possible_map = numa_nodes_parsed;
-
 	return 0;
 }
 
-- 
2.43.0


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

* Re: [PATCH v2 0/9] treewide, numa_memblks: remove redundant work during NUMA init
  2026-07-03  4:13 [PATCH v2 0/9] treewide, numa_memblks: remove redundant work during NUMA init Sang-Heon Jeon
  2026-07-03  4:13 ` [PATCH v2 5/9] arch_numa: remove redundant numa_nodes_parsed node_set() Sang-Heon Jeon
  2026-07-03  4:13 ` [PATCH v2 8/9] arch_numa: remove redundant node_possible_map assignment Sang-Heon Jeon
@ 2026-07-03  9:43 ` Mike Rapoport
  2 siblings, 0 replies; 4+ messages in thread
From: Mike Rapoport @ 2026-07-03  9:43 UTC (permalink / raw)
  To: akpm, Andy Lutomirski, Borislav Petkov, Danilo Krummrich,
	Dave Hansen, Greg Kroah-Hartman, Huacai Chen, Ingo Molnar,
	Peter Zijlstra, Rafael J. Wysocki, Rob Herring, Saravana Kannan,
	Thomas Gleixner, Sang-Heon Jeon
  Cc: Mike Rapoport, linux-mm, devicetree, driver-core, H. Peter Anvin,
	Len Brown, linux-acpi, linux-kernel, loongarch, WANG Xuerui, x86

On Fri,  3 Jul 2026 13:13:20 +0900, Sang-Heon Jeon wrote:
> 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().
> 
> [...]

Applied to numa_memblks-redundant-work branch of memblock.git tree, thanks!

[1/9] mm: numa_memblks: set numa_nodes_parsed in numa_add_memblk()
      commit: abdbd8329281f40afd381346410d6d43604af82c
[2/9] ACPI: NUMA: remove redundant numa_nodes_parsed node_set()
      commit: 7cbdade40fb8f440c13ccd7a02d104bf32285187
[3/9] of/numa: remove redundant numa_nodes_parsed node_set()
      commit: 3b1e5d902dfa832e4b175cb1f5a000236d45ceb5
[4/9] x86/numa: remove redundant numa_nodes_parsed node_set()
      commit: 63fa742bae02f0d2ffe95ff540a51837815abc5c
[5/9] arch_numa: remove redundant numa_nodes_parsed node_set()
      commit: 8b9cecbdc78c5a6cfaaf3b00ce7ebe05cf5417e7
[6/9] LoongArch: remove redundant numa_nodes_parsed node_set()
      commit: 3aeac07c5b1c3399487f4b38182f8cfbc3dbbd53
[7/9] mm: numa_memblks: remove redundant numa_nodemask_from_meminfo()
      commit: a9bafc1832d2db97813069823821ed333b8ecda6
[8/9] arch_numa: remove redundant node_possible_map assignment
      commit: f5a77a50a14dffb659ee8f550c824f8280e37fce
[9/9] mm: numa_memblks: use numa_add_reserved_memblk() in numa_cleanup_meminfo()
      commit: e55424c84afd48aa2f0f761ae0c006128ef541cf

tree: https://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock
branch: numa_memblks-redundant-work

--
Sincerely yours,
Mike.


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

end of thread, other threads:[~2026-07-03  9:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-03  4:13 [PATCH v2 0/9] treewide, numa_memblks: remove redundant work during NUMA init Sang-Heon Jeon
2026-07-03  4:13 ` [PATCH v2 5/9] arch_numa: remove redundant numa_nodes_parsed node_set() Sang-Heon Jeon
2026-07-03  4:13 ` [PATCH v2 8/9] arch_numa: remove redundant node_possible_map assignment Sang-Heon Jeon
2026-07-03  9:43 ` [PATCH v2 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