linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] mm/fake-numa: fix under-allocation detection in uniform split
@ 2026-04-17 13:58 Sang-Heon Jeon
  2026-04-20  6:31 ` Mike Rapoport
  0 siblings, 1 reply; 6+ messages in thread
From: Sang-Heon Jeon @ 2026-04-17 13:58 UTC (permalink / raw)
  To: akpm, rppt, djbw, mingo
  Cc: linux-mm, Sang-Heon Jeon, Donghyeon Lee, Munhui Chae

When split NUMA node uniformly, split_nodes_size_interleave_uniform()
returns the next absolute node ID, not the number of nodes created.

The existing under-allocation detection logic compares next absolute node
ID (ret) and request count (n), which only works when nid starts at 0.

For example, on a system with 2 physical NUMA nodes (node 0: 2GB, node
1: 128MB) and numa=fake=8U, 8 fake nodes are successfully created from
node 0 and split_nodes_size_interleave_uniform() returns 8. For node 1,
fake node nid starts at 8, but only 4 fake nodes are created due to
current FAKE_NODE_MIN_SIZE being 32MB, and
split_nodes_size_interleave_uniform() returns 12. By existing
under-allocation detection logic, "ret < n" (12 < 8) is false, so the
under-allocation will not be detected.

Fix under-allocation detection logic to compare the number of actually
created nodes (ret - nid) against the request count (n). Also skip
under-allocation detection logic for memoryless physical nodes where no
fake nodes are created.

Also, fix the outdated comment to match the actual return value.

Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
Reported-by: Donghyeon Lee <asd142513@gmail.com>
Reported-by: Munhui Chae <mochae@student.42seoul.kr>
Fixes: cc9aec03e58f ("x86/numa_emulation: Introduce uniform split capability") # 4.19
---
Changes from RFC v1 [1]
- Merge patchset into once.
- Change base from linux-next to mm-unstable

Changes from RFC v2 [2]
- Fix error message to use the number of created node instead of
  returned node ID.
- Define nr_created variable to explicitly show the number of created
  nodes.

Changes from v1 [1]
- Skip under-allocation check for memoryless node where no fake nodes
  are created.

[1] https://lore.kernel.org/all/20260413154438.396031-1-ekffu200098@gmail.com/
[2] https://lore.kernel.org/all/20260416102558.575210-1-ekffu200098@gmail.com/
[3] https://lore.kernel.org/all/20260417114127.1664283-1-ekffu200098@gmail.com/
---
QEMU-based test results

1) Check under-allocation is well detected (based on commit message
scenario)
  a) AS-IS (before fix)
[    0.001878] NUMA: Node 0 [mem 0x00001000-0x0009ffff] + [mem 0x00100000-0x7fffffff] ]
[    0.001881] Fake node size 255MB too small, increasing to 256MB
[    0.001882] Faking node 0 at [mem 0x0000000000001000-0x0000000010000fff] (256MB)
[    0.001883] Faking node 1 at [mem 0x0000000010001000-0x0000000020000fff] (256MB)
[    0.001883] Faking node 2 at [mem 0x0000000020001000-0x0000000030000fff] (256MB)
[    0.001884] Faking node 3 at [mem 0x0000000030001000-0x0000000040000fff] (256MB)
[    0.001884] Faking node 4 at [mem 0x0000000040001000-0x0000000050000fff] (256MB)
[    0.001884] Faking node 5 at [mem 0x0000000050001000-0x0000000060000fff] (256MB)
[    0.001885] Faking node 6 at [mem 0x0000000060001000-0x0000000070000fff] (256MB)
[    0.001885] Faking node 7 at [mem 0x0000000070001000-0x000000007fffffff] (255MB)
[    0.001885] Fake node size 15MB too small, increasing to 32MB
[    0.001886] Faking node 8 at [mem 0x0000000080000000-0x0000000081ffffff] (32MB)
[    0.001886] Faking node 9 at [mem 0x0000000082000000-0x0000000083ffffff] (32MB)
[    0.001887] Faking node 10 at [mem 0x0000000084000000-0x0000000087fdcfff] (63MB)
[    0.001924] NODE_DATA(0) allocated [mem 0x0fffd6c0-0x10000fff]
[    0.019852] NODE_DATA(1) allocated [mem 0x1fffd6c0-0x20000fff]
[    0.022458] NODE_DATA(2) allocated [mem 0x2dffc6c0-0x2dffffff]
[    0.023293] NODE_DATA(3) allocated [mem 0x3fffd6c0-0x40000fff]
[    0.028522] NODE_DATA(4) allocated [mem 0x4fffd6c0-0x50000fff]
[    0.032397] NODE_DATA(5) allocated [mem 0x5fffd6c0-0x60000fff]
[    0.036552] NODE_DATA(6) allocated [mem 0x6fffd6c0-0x70000fff]
[    0.038746] NODE_DATA(7) allocated [mem 0x7fffc6c0-0x7fffffff]
[    0.040286] NODE_DATA(8) allocated [mem 0x81ffc6c0-0x81ffffff]
[    0.041517] NODE_DATA(9) allocated [mem 0x83ffc6c0-0x83ffffff]
[    0.043678] NODE_DATA(10) allocated [mem 0x87fd86c0-0x87fdbfff]

  b) TO-BE (after fix)
[    0.001858] NUMA: Node 0 [mem 0x00001000-0x0009ffff] + [mem 0x00100000-0x7fffffff] ]
[    0.001860] Fake node size 255MB too small, increasing to 256MB
[    0.001861] Faking node 0 at [mem 0x0000000000001000-0x0000000010000fff] (256MB)
[    0.001861] Faking node 1 at [mem 0x0000000010001000-0x0000000020000fff] (256MB)
[    0.001862] Faking node 2 at [mem 0x0000000020001000-0x0000000030000fff] (256MB)
[    0.001862] Faking node 3 at [mem 0x0000000030001000-0x0000000040000fff] (256MB)
[    0.001863] Faking node 4 at [mem 0x0000000040001000-0x0000000050000fff] (256MB)
[    0.001863] Faking node 5 at [mem 0x0000000050001000-0x0000000060000fff] (256MB)
[    0.001863] Faking node 6 at [mem 0x0000000060001000-0x0000000070000fff] (256MB)
[    0.001864] Faking node 7 at [mem 0x0000000070001000-0x000000007fffffff] (255MB)
[    0.001864] Fake node size 15MB too small, increasing to 32MB
[    0.001864] Faking node 8 at [mem 0x0000000080000000-0x0000000081ffffff] (32MB)
[    0.001865] Faking node 9 at [mem 0x0000000082000000-0x0000000083ffffff] (32MB)
[    0.001865] Faking node 10 at [mem 0x0000000084000000-0x0000000087fdcfff] (63MB)
[    0.001866] numa_emulation: phys: 1 only got 3 of 8 nodes, failing
[    0.001867] NODE_DATA(0) allocated [mem 0x7fffc6c0-0x7fffffff]
[    0.001940] NODE_DATA(1) allocated [mem 0x87fd96c0-0x87fdcfff]

2) No false failure with memoryless node
- Node 0: 2GB, Node 1: memoryless
- numa=fake=2U

  a) AS-IS (before fix)
[    0.001843] NUMA: Node 0 [mem 0x00001000-0x0009ffff] + [mem 0x00100000-0x7ffdcfff] -> [mem 0x00001000-0x7ffdcfff]
[    0.001845] Fake node size 1023MB too small, increasing to 1024MB
[    0.001846] Faking node 0 at [mem 0x0000000000001000-0x0000000040000fff] (1024MB)
[    0.001846] Faking node 1 at [mem 0x0000000040001000-0x000000007ffdcfff] (1023MB)
[    0.001847] Fake node size 0MB too small, increasing to 32MB
[    0.001869] NODE_DATA(0) allocated [mem 0x3fffd6c0-0x40000fff]
[    0.002023] NODE_DATA(1) allocated [mem 0x7ffd86c0-0x7ffdbfff]

  b) TO-BE (after fix)
[    0.001862] NUMA: Node 0 [mem 0x00001000-0x0009ffff] + [mem 0x00100000-0x7ffdcfff] -> [mem 0x00001000-0x7ffdcfff]
[    0.001864] Fake node size 1023MB too small, increasing to 1024MB
[    0.001865] Faking node 0 at [mem 0x0000000000001000-0x0000000040000fff] (1024MB)
[    0.001866] Faking node 1 at [mem 0x0000000040001000-0x000000007ffdcfff] (1023MB)
[    0.001866] Fake node size 0MB too small, increasing to 32MB
[    0.001889] NODE_DATA(0) allocated [mem 0x3fffd6c0-0x40000fff]
[    0.002034] NODE_DATA(1) allocated [mem 0x7ffd86c0-0x7ffdbfff]

And also there is other scenario tested by Donghyeon. [1]

[1] https://lore.kernel.org/all/CAFPTC5e1OLpHa3HqwhtSPjS_PTQz+iG=ovM2cZ=VnOZ_5z7oxg@mail.gmail.com/

---

 mm/numa_emulation.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/mm/numa_emulation.c b/mm/numa_emulation.c
index 703c8fa05048..5d72559fcdf2 100644
--- a/mm/numa_emulation.c
+++ b/mm/numa_emulation.c
@@ -214,7 +214,7 @@ static u64 uniform_size(u64 max_addr, u64 base, u64 hole, int nr_nodes)
  * Sets up fake nodes of `size' interleaved over physical nodes ranging from
  * `addr' to `max_addr'.
  *
- * Returns zero on success or negative on error.
+ * Returns absolute node ID on success or negative on error.
  */
 static int __init split_nodes_size_interleave_uniform(struct numa_meminfo *ei,
 					      struct numa_meminfo *pi,
@@ -398,7 +398,7 @@ void __init numa_emulation(struct numa_meminfo *numa_meminfo, int numa_dist_cnt)
 	 */
 	if (strchr(emu_cmdline, 'U')) {
 		unsigned long n;
-		int nid = 0;
+		int nid = 0, nr_created;
 
 		n = simple_strtoul(emu_cmdline, &emu_cmdline, 0);
 		ret = -1;
@@ -416,9 +416,18 @@ void __init numa_emulation(struct numa_meminfo *numa_meminfo, int numa_dist_cnt)
 					n, &pi.blk[0], nid);
 			if (ret < 0)
 				break;
-			if (ret < n) {
+
+			/*
+			 * If no memory was found for this physical node,
+			 * skip the under-allocation check. 
+			 */
+			if (ret == nid)
+				continue;
+
+			nr_created = ret - nid;
+			if (nr_created < n) {
 				pr_info("%s: phys: %d only got %d of %ld nodes, failing\n",
-						__func__, i, ret, n);
+						__func__, i, nr_created, n);
 				ret = -1;
 				break;
 			}
-- 
2.43.0



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

* Re: [PATCH v2] mm/fake-numa: fix under-allocation detection in uniform split
  2026-04-17 13:58 [PATCH v2] mm/fake-numa: fix under-allocation detection in uniform split Sang-Heon Jeon
@ 2026-04-20  6:31 ` Mike Rapoport
  2026-04-20 13:50   ` Sang-Heon Jeon
  2026-04-20 14:26   ` Sang-Heon Jeon
  0 siblings, 2 replies; 6+ messages in thread
From: Mike Rapoport @ 2026-04-20  6:31 UTC (permalink / raw)
  To: Sang-Heon Jeon; +Cc: akpm, djbw, mingo, linux-mm, Donghyeon Lee, Munhui Chae

Hi,

On Fri, Apr 17, 2026 at 10:58:05PM +0900, Sang-Heon Jeon wrote:
> When split NUMA node uniformly, split_nodes_size_interleave_uniform()
> returns the next absolute node ID, not the number of nodes created.
> 
> The existing under-allocation detection logic compares next absolute node
> ID (ret) and request count (n), which only works when nid starts at 0.
> 
> For example, on a system with 2 physical NUMA nodes (node 0: 2GB, node
> 1: 128MB) and numa=fake=8U, 8 fake nodes are successfully created from
> node 0 and split_nodes_size_interleave_uniform() returns 8. For node 1,
> fake node nid starts at 8, but only 4 fake nodes are created due to
> current FAKE_NODE_MIN_SIZE being 32MB, and
> split_nodes_size_interleave_uniform() returns 12. By existing
> under-allocation detection logic, "ret < n" (12 < 8) is false, so the

In this example it would be 11, won't it?
I'll update when applying.

> under-allocation will not be detected.
> 
> Fix under-allocation detection logic to compare the number of actually
> created nodes (ret - nid) against the request count (n). Also skip
> under-allocation detection logic for memoryless physical nodes where no
> fake nodes are created.
> 
> Also, fix the outdated comment to match the actual return value.
> 
> Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
> Reported-by: Donghyeon Lee <asd142513@gmail.com>
> Reported-by: Munhui Chae <mochae@student.42seoul.kr>
> Fixes: cc9aec03e58f ("x86/numa_emulation: Introduce uniform split capability") # 4.19

...

> @@ -416,9 +416,18 @@ void __init numa_emulation(struct numa_meminfo *numa_meminfo, int numa_dist_cnt)
>  					n, &pi.blk[0], nid);
>  			if (ret < 0)
>  				break;
> -			if (ret < n) {
> +
> +			/*
> +			 * If no memory was found for this physical node,
> +			 * skip the under-allocation check. 

checkpatch complains about trailing white space here.
I'll fix it up when applying.

> +			 */
> +			if (ret == nid)
> +				continue;
> +
> +			nr_created = ret - nid;
> +			if (nr_created < n) {
>  				pr_info("%s: phys: %d only got %d of %ld nodes, failing\n",
> -						__func__, i, ret, n);
> +						__func__, i, nr_created, n);
>  				ret = -1;
>  				break;
>  			}
> -- 
> 2.43.0
> 

-- 
Sincerely yours,
Mike.


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

* Re: [PATCH v2] mm/fake-numa: fix under-allocation detection in uniform split
  2026-04-20  6:31 ` Mike Rapoport
@ 2026-04-20 13:50   ` Sang-Heon Jeon
  2026-04-20 14:26   ` Sang-Heon Jeon
  1 sibling, 0 replies; 6+ messages in thread
From: Sang-Heon Jeon @ 2026-04-20 13:50 UTC (permalink / raw)
  To: Mike Rapoport; +Cc: akpm, djbw, mingo, linux-mm, Donghyeon Lee, Munhui Chae

Hi

On Mon, Apr 20, 2026 at 3:31 PM Mike Rapoport <rppt@kernel.org> wrote:
>
> Hi,
>
> On Fri, Apr 17, 2026 at 10:58:05PM +0900, Sang-Heon Jeon wrote:
> > When split NUMA node uniformly, split_nodes_size_interleave_uniform()
> > returns the next absolute node ID, not the number of nodes created.
> >
> > The existing under-allocation detection logic compares next absolute node
> > ID (ret) and request count (n), which only works when nid starts at 0.
> >
> > For example, on a system with 2 physical NUMA nodes (node 0: 2GB, node
> > 1: 128MB) and numa=fake=8U, 8 fake nodes are successfully created from
> > node 0 and split_nodes_size_interleave_uniform() returns 8. For node 1,
> > fake node nid starts at 8, but only 4 fake nodes are created due to
> > current FAKE_NODE_MIN_SIZE being 32MB, and
> > split_nodes_size_interleave_uniform() returns 12. By existing
> > under-allocation detection logic, "ret < n" (12 < 8) is false, so the
>
> In this example it would be 11, won't it?
> I'll update when applying.

I think 12 is correct because there is a difference between the
attached QEMU test log and the scenario which is described in the
commit message. This is because I missed the reserved memory (~140KB)
for ACPI table.

1) Previous attached QEMU test scenario

QEMU command line :
    qemu-system-x86_64 \
    ...
    -m 2176M \
    -object memory-backend-ram,id=mem0,size=2G \
    -object memory-backend-ram,id=mem1,size=128M \
    -numa node,nodeid=0,cpus=0-1,memdev=mem0 \
    -numa node,nodeid=1,cpus=2-3,memdev=mem1 \

log :
[    0.000000] BIOS-provided physical RAM map:
[    0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff]
System RAM
[    0.000000] BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff]
device reserved
[    0.000000] BIOS-e820: [gap 0x00000000000a0000-0x00000000000effff]
[    0.000000] BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff]
device reserved
[    0.000000] BIOS-e820: [mem 0x0000000000100000-0x0000000087fdcfff]
System RAM
[    0.000000] BIOS-e820: [mem 0x0000000087fdd000-0x0000000087ffffff]
device reserved
[    0.000000] BIOS-e820: [gap 0x0000000088000000-0x00000000feffbfff]
[    0.000000] BIOS-e820: [mem 0x00000000feffc000-0x00000000feffffff]
device reserved
[    0.000000] BIOS-e820: [gap 0x00000000ff000000-0x00000000fffbffff]
[    0.000000] BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff]
device reserved
[    0.000000] BIOS-e820: [gap 0x0000000100000000-0x000000fcffffffff]
[    0.000000] BIOS-e820: [mem 0x000000fd00000000-0x000000ffffffffff]
device reserved

...

[    0.001919] ACPI: SRAT: Node 0 PXM 0 [mem 0x00000000-0x0009ffff]
[    0.001921] ACPI: SRAT: Node 0 PXM 0 [mem 0x00100000-0x7fffffff]
[    0.001922] ACPI: SRAT: Node 1 PXM 1 [mem 0x80000000-0x87ffffff]

...

[    0.001930] Fake node size 15MB too small, increasing to 32MB
[    0.001930] Faking node 8 at [mem
0x0000000080000000-0x0000000081ffffff] (32MB)
[    0.001931] Faking node 9 at [mem
0x0000000082000000-0x0000000083ffffff] (32MB)
[    0.001931] Faking node 10 at [mem
0x0000000084000000-0x0000000087fdcfff] (63MB)

So actual node 1 usable memory is [0x80000000-0x87fdcfff] (~127.86MB)
That's why uniformly splitted memory count is 3 for node 1

2) Commit message scenario (Log is newly attached)

QEMU command line :
     ...
     -m 2228480K \
    -object memory-backend-ram,id=mem0,size=2G \
    -object memory-backend-ram,id=mem1,size=131328K \ # 128MB + 256KB for margin
    -numa node,nodeid=0,cpus=0-1,memdev=mem0 \
    -numa node,nodeid=1,cpus=2-3,memdev=mem1 \

log:
[    0.000000] BIOS-provided physical RAM map:
[    0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff]
System RAM
[    0.000000] BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff]
device reserved
[    0.000000] BIOS-e820: [gap 0x00000000000a0000-0x00000000000effff]
[    0.000000] BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff]
device reserved
[    0.000000] BIOS-e820: [mem 0x0000000000100000-0x000000008801cfff]
System RAM
[    0.000000] BIOS-e820: [mem 0x000000008801d000-0x000000008803ffff]
device reserved
[    0.000000] BIOS-e820: [gap 0x0000000088040000-0x00000000feffbfff]
[    0.000000] BIOS-e820: [mem 0x00000000feffc000-0x00000000feffffff]
device reserved
[    0.000000] BIOS-e820: [gap 0x00000000ff000000-0x00000000fffbffff]
[    0.000000] BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff]
device reserved
[    0.000000] BIOS-e820: [gap 0x0000000100000000-0x000000fcffffffff]
[    0.000000] BIOS-e820: [mem 0x000000fd00000000-0x000000ffffffffff]
device reserved

...

[    0.001870] ACPI: SRAT: Node 0 PXM 0 [mem 0x00000000-0x0009ffff]
[    0.001871] ACPI: SRAT: Node 0 PXM 0 [mem 0x00100000-0x7fffffff]
[    0.001872] ACPI: SRAT: Node 1 PXM 1 [mem 0x80000000-0x8803ffff]

...

[    0.001888] Fake node size 16MB too small, increasing to 32MB
[    0.001888] Faking node 8 at [mem
0x0000000080000000-0x0000000081ffffff] (32MB)
[    0.001888] Faking node 9 at [mem
0x0000000082000000-0x0000000083ffffff] (32MB)
[    0.001889] Faking node 10 at [mem
0x0000000084000000-0x0000000085ffffff] (32MB)
[    0.001889] Faking node 11 at [mem
0x0000000086000000-0x000000008801cfff] (32MB) # (~32.11MB)

So actual node 1 usable memory is [0x80000000-0x8801cfff] (~128.11MB)
And Node 1 is successfully uniformly splitted into 4 fake nodes.

Sorry for causing confusion due to the wrong example.

> > under-allocation will not be detected.
> >
> > Fix under-allocation detection logic to compare the number of actually
> > created nodes (ret - nid) against the request count (n). Also skip
> > under-allocation detection logic for memoryless physical nodes where no
> > fake nodes are created.
> >
> > Also, fix the outdated comment to match the actual return value.
> >
> > Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
> > Reported-by: Donghyeon Lee <asd142513@gmail.com>
> > Reported-by: Munhui Chae <mochae@student.42seoul.kr>
> > Fixes: cc9aec03e58f ("x86/numa_emulation: Introduce uniform split capability") # 4.19
>
> ...
>
> > @@ -416,9 +416,18 @@ void __init numa_emulation(struct numa_meminfo *numa_meminfo, int numa_dist_cnt)
> >                                       n, &pi.blk[0], nid);
> >                       if (ret < 0)
> >                               break;
> > -                     if (ret < n) {
> > +
> > +                     /*
> > +                      * If no memory was found for this physical node,
> > +                      * skip the under-allocation check.
>
> checkpatch complains about trailing white space here.
> I'll fix it up when applying.

Oops, I missed it. Thank you for pointing it out!

> > +                      */
> > +                     if (ret == nid)
> > +                             continue;
> > +
> > +                     nr_created = ret - nid;
> > +                     if (nr_created < n) {
> >                               pr_info("%s: phys: %d only got %d of %ld nodes, failing\n",
> > -                                             __func__, i, ret, n);
> > +                                             __func__, i, nr_created, n);
> >                               ret = -1;
> >                               break;
> >                       }
> > --
> > 2.43.0
> >
>
> --
> Sincerely yours,
> Mike.

I really appreciate your detailed review :)

Best Regards,
Sang-Heon Jeon


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

* Re: [PATCH v2] mm/fake-numa: fix under-allocation detection in uniform split
  2026-04-20  6:31 ` Mike Rapoport
  2026-04-20 13:50   ` Sang-Heon Jeon
@ 2026-04-20 14:26   ` Sang-Heon Jeon
  2026-04-21  6:29     ` Mike Rapoport
  1 sibling, 1 reply; 6+ messages in thread
From: Sang-Heon Jeon @ 2026-04-20 14:26 UTC (permalink / raw)
  To: Mike Rapoport; +Cc: akpm, djbw, mingo, linux-mm, Donghyeon Lee, Munhui Chae

Hi

On Mon, Apr 20, 2026 at 3:31 PM Mike Rapoport <rppt@kernel.org> wrote:
>
> Hi,
>
> On Fri, Apr 17, 2026 at 10:58:05PM +0900, Sang-Heon Jeon wrote:
> > When split NUMA node uniformly, split_nodes_size_interleave_uniform()
> > returns the next absolute node ID, not the number of nodes created.
> >
> > The existing under-allocation detection logic compares next absolute node
> > ID (ret) and request count (n), which only works when nid starts at 0.
> >
> > For example, on a system with 2 physical NUMA nodes (node 0: 2GB, node
> > 1: 128MB) and numa=fake=8U, 8 fake nodes are successfully created from
> > node 0 and split_nodes_size_interleave_uniform() returns 8. For node 1,
> > fake node nid starts at 8, but only 4 fake nodes are created due to
> > current FAKE_NODE_MIN_SIZE being 32MB, and
> > split_nodes_size_interleave_uniform() returns 12. By existing
> > under-allocation detection logic, "ret < n" (12 < 8) is false, so the
>
> In this example it would be 11, won't it?
> I'll update when applying.

Oops, my previous reply is not the main point of this review. (Please ignore it)
But 12 is still correct, because split_nodes_size_interleave_uniform()
returns next available node ID.

IMHO, it would be clearer if both the commit message and the function
comment change into "next available node ID".
If you're okay with it, I'll create v3 patch soon, including minor fix below

Sorry for the inconvenience.

> > under-allocation will not be detected.
> >
> > Fix under-allocation detection logic to compare the number of actually
> > created nodes (ret - nid) against the request count (n). Also skip
> > under-allocation detection logic for memoryless physical nodes where no
> > fake nodes are created.
> >
> > Also, fix the outdated comment to match the actual return value.
> >
> > Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
> > Reported-by: Donghyeon Lee <asd142513@gmail.com>
> > Reported-by: Munhui Chae <mochae@student.42seoul.kr>
> > Fixes: cc9aec03e58f ("x86/numa_emulation: Introduce uniform split capability") # 4.19
>
> ...
>
> > @@ -416,9 +416,18 @@ void __init numa_emulation(struct numa_meminfo *numa_meminfo, int numa_dist_cnt)
> >                                       n, &pi.blk[0], nid);
> >                       if (ret < 0)
> >                               break;
> > -                     if (ret < n) {
> > +
> > +                     /*
> > +                      * If no memory was found for this physical node,
> > +                      * skip the under-allocation check.
>
> checkpatch complains about trailing white space here.
> I'll fix it up when applying.
>
> > +                      */
> > +                     if (ret == nid)
> > +                             continue;
> > +
> > +                     nr_created = ret - nid;
> > +                     if (nr_created < n) {
> >                               pr_info("%s: phys: %d only got %d of %ld nodes, failing\n",
> > -                                             __func__, i, ret, n);
> > +                                             __func__, i, nr_created, n);
> >                               ret = -1;
> >                               break;
> >                       }
> > --
> > 2.43.0
> >
>
> --
> Sincerely yours,
> Mike.

Best Regards,
Sang-Heon Jeon


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

* Re: [PATCH v2] mm/fake-numa: fix under-allocation detection in uniform split
  2026-04-20 14:26   ` Sang-Heon Jeon
@ 2026-04-21  6:29     ` Mike Rapoport
  2026-04-21  6:56       ` Sang-Heon Jeon
  0 siblings, 1 reply; 6+ messages in thread
From: Mike Rapoport @ 2026-04-21  6:29 UTC (permalink / raw)
  To: Sang-Heon Jeon; +Cc: akpm, djbw, mingo, linux-mm, Donghyeon Lee, Munhui Chae

On Mon, Apr 20, 2026 at 11:26:13PM +0900, Sang-Heon Jeon wrote:
> On Mon, Apr 20, 2026 at 3:31 PM Mike Rapoport <rppt@kernel.org> wrote:
> > On Fri, Apr 17, 2026 at 10:58:05PM +0900, Sang-Heon Jeon wrote:
> > > When split NUMA node uniformly, split_nodes_size_interleave_uniform()
> > > returns the next absolute node ID, not the number of nodes created.
> > >
> > > The existing under-allocation detection logic compares next absolute node
> > > ID (ret) and request count (n), which only works when nid starts at 0.
> > >
> > > For example, on a system with 2 physical NUMA nodes (node 0: 2GB, node
> > > 1: 128MB) and numa=fake=8U, 8 fake nodes are successfully created from
> > > node 0 and split_nodes_size_interleave_uniform() returns 8. For node 1,
> > > fake node nid starts at 8, but only 4 fake nodes are created due to
> > > current FAKE_NODE_MIN_SIZE being 32MB, and
> > > split_nodes_size_interleave_uniform() returns 12. By existing
> > > under-allocation detection logic, "ret < n" (12 < 8) is false, so the
> >
> > In this example it would be 11, won't it?
> > I'll update when applying.
> 
> Oops, my previous reply is not the main point of this review. (Please ignore it)
> But 12 is still correct, because split_nodes_size_interleave_uniform()
> returns next available node ID.
> 
> IMHO, it would be clearer if both the commit message and the function
> comment change into "next available node ID".
> If you're okay with it, I'll create v3 patch soon, including minor fix below

No need for v3, I updated the comment and the whitespace:
https://git.kernel.org/rppt/memblock/c/a34436ac05e76bd6634a89fc0a399ab3a48f509a
 
> Best Regards,
> Sang-Heon Jeon

-- 
Sincerely yours,
Mike.


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

* Re: [PATCH v2] mm/fake-numa: fix under-allocation detection in uniform split
  2026-04-21  6:29     ` Mike Rapoport
@ 2026-04-21  6:56       ` Sang-Heon Jeon
  0 siblings, 0 replies; 6+ messages in thread
From: Sang-Heon Jeon @ 2026-04-21  6:56 UTC (permalink / raw)
  To: Mike Rapoport; +Cc: akpm, djbw, mingo, linux-mm, Donghyeon Lee, Munhui Chae

Hi

On Tue, Apr 21, 2026 at 3:29 PM Mike Rapoport <rppt@kernel.org> wrote:
>
> On Mon, Apr 20, 2026 at 11:26:13PM +0900, Sang-Heon Jeon wrote:
> > On Mon, Apr 20, 2026 at 3:31 PM Mike Rapoport <rppt@kernel.org> wrote:
> > > On Fri, Apr 17, 2026 at 10:58:05PM +0900, Sang-Heon Jeon wrote:
> > > > When split NUMA node uniformly, split_nodes_size_interleave_uniform()
> > > > returns the next absolute node ID, not the number of nodes created.
> > > >
> > > > The existing under-allocation detection logic compares next absolute node
> > > > ID (ret) and request count (n), which only works when nid starts at 0.
> > > >
> > > > For example, on a system with 2 physical NUMA nodes (node 0: 2GB, node
> > > > 1: 128MB) and numa=fake=8U, 8 fake nodes are successfully created from
> > > > node 0 and split_nodes_size_interleave_uniform() returns 8. For node 1,
> > > > fake node nid starts at 8, but only 4 fake nodes are created due to
> > > > current FAKE_NODE_MIN_SIZE being 32MB, and
> > > > split_nodes_size_interleave_uniform() returns 12. By existing
> > > > under-allocation detection logic, "ret < n" (12 < 8) is false, so the
> > >
> > > In this example it would be 11, won't it?
> > > I'll update when applying.
> >
> > Oops, my previous reply is not the main point of this review. (Please ignore it)
> > But 12 is still correct, because split_nodes_size_interleave_uniform()
> > returns next available node ID.
> >
> > IMHO, it would be clearer if both the commit message and the function
> > comment change into "next available node ID".
> > If you're okay with it, I'll create v3 patch soon, including minor fix below
>
> No need for v3, I updated the comment and the whitespace:
> https://git.kernel.org/rppt/memblock/c/a34436ac05e76bd6634a89fc0a399ab3a48f509a

Thanks for your help, Mike. However, it seems like '12' was changed to
'11' in the commit message. I think this change should be rolled back.
Could you check?

> > Best Regards,
> > Sang-Heon Jeon
>
> --
> Sincerely yours,
> Mike.

Best Regards,
Sang-Heon Jeon


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

end of thread, other threads:[~2026-04-21  6:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-04-17 13:58 [PATCH v2] mm/fake-numa: fix under-allocation detection in uniform split Sang-Heon Jeon
2026-04-20  6:31 ` Mike Rapoport
2026-04-20 13:50   ` Sang-Heon Jeon
2026-04-20 14:26   ` Sang-Heon Jeon
2026-04-21  6:29     ` Mike Rapoport
2026-04-21  6:56       ` Sang-Heon Jeon

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