linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 0/2] mm/fake-numa: fix under-allocation detection logic in uniform split
@ 2026-04-13 15:44 Sang-Heon Jeon
  2026-04-13 15:44 ` [RFC PATCH 1/2] " Sang-Heon Jeon
  2026-04-13 15:44 ` [RFC PATCH 2/2] mm/fake-numa: fix outdated return value comment Sang-Heon Jeon
  0 siblings, 2 replies; 5+ messages in thread
From: Sang-Heon Jeon @ 2026-04-13 15:44 UTC (permalink / raw)
  To: akpm, rppt, djbw, mingo; +Cc: linux-mm, Sang-Heon Jeon

Hello,

This series fixes under-allocation detection logic and an outdated
comment in uniform NUMA node splitting.

I found this while going through NUMA enulation codes. If I
misunderstood, feel free to tell me about it.

Thank you for taking your valuable time to review this work.

Best Regards,
Sang-Heon Jeon

Sang-Heon Jeon (2):
  mm/fake-numa: fix under-allocation detection in uniform split
  mm/fake-numa: fix outdated return value comment

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

-- 
2.43.0



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

* [RFC PATCH 1/2] mm/fake-numa: fix under-allocation detection logic in uniform split
  2026-04-13 15:44 [RFC PATCH 0/2] mm/fake-numa: fix under-allocation detection logic in uniform split Sang-Heon Jeon
@ 2026-04-13 15:44 ` Sang-Heon Jeon
  2026-04-14 12:37   ` Mike Rapoport
  2026-04-13 15:44 ` [RFC PATCH 2/2] mm/fake-numa: fix outdated return value comment Sang-Heon Jeon
  1 sibling, 1 reply; 5+ messages in thread
From: Sang-Heon Jeon @ 2026-04-13 15:44 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 previous under-allocation detection logic compares next absolute node
ID (ret) and request count (n), which only works when nid starts at 0.

Fix under-allocation detection logic to compare the number of actually
created nodes (ret - nid) against the request count (n).

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
---
 mm/numa_emulation.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/numa_emulation.c b/mm/numa_emulation.c
index 703c8fa05048..e7f856c8f2a1 100644
--- a/mm/numa_emulation.c
+++ b/mm/numa_emulation.c
@@ -416,7 +416,7 @@ 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 (ret - nid < n) {
 				pr_info("%s: phys: %d only got %d of %ld nodes, failing\n",
 						__func__, i, ret, n);
 				ret = -1;
-- 
2.43.0



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

* [RFC PATCH 2/2] mm/fake-numa: fix outdated return value comment
  2026-04-13 15:44 [RFC PATCH 0/2] mm/fake-numa: fix under-allocation detection logic in uniform split Sang-Heon Jeon
  2026-04-13 15:44 ` [RFC PATCH 1/2] " Sang-Heon Jeon
@ 2026-04-13 15:44 ` Sang-Heon Jeon
  2026-04-14 12:37   ` Mike Rapoport
  1 sibling, 1 reply; 5+ messages in thread
From: Sang-Heon Jeon @ 2026-04-13 15:44 UTC (permalink / raw)
  To: akpm, rppt, djbw, mingo; +Cc: linux-mm, Sang-Heon Jeon

split_nodes_size_interleave_uniform() returns absolute node ID when
succeed, not zero.

Fix the outdated comment to match the actual return value.

Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
---
 mm/numa_emulation.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/numa_emulation.c b/mm/numa_emulation.c
index e7f856c8f2a1..c1d0a76aef64 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,
-- 
2.43.0



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

* Re: [RFC PATCH 1/2] mm/fake-numa: fix under-allocation detection logic in uniform split
  2026-04-13 15:44 ` [RFC PATCH 1/2] " Sang-Heon Jeon
@ 2026-04-14 12:37   ` Mike Rapoport
  0 siblings, 0 replies; 5+ messages in thread
From: Mike Rapoport @ 2026-04-14 12:37 UTC (permalink / raw)
  To: Sang-Heon Jeon; +Cc: akpm, djbw, mingo, linux-mm, Donghyeon Lee, Munhui Chae

Hi,

On Tue, Apr 14, 2026 at 12:44:37AM +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 previous under-allocation detection logic compares next absolute node

I'd replace "previous" with "existing"

> ID (ret) and request count (n), which only works when nid starts at 0.
> 
> Fix under-allocation detection logic to compare the number of actually
> created nodes (ret - nid) against the request count (n).

It would be nice to have an example of memory configuration and
numa=fake=nU that demonstrates the issue.
 
> 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
> ---
>  mm/numa_emulation.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/numa_emulation.c b/mm/numa_emulation.c
> index 703c8fa05048..e7f856c8f2a1 100644
> --- a/mm/numa_emulation.c
> +++ b/mm/numa_emulation.c
> @@ -416,7 +416,7 @@ 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 (ret - nid < n) {
>  				pr_info("%s: phys: %d only got %d of %ld nodes, failing\n",
>  						__func__, i, ret, n);
>  				ret = -1;
> -- 
> 2.43.0
> 

-- 
Sincerely yours,
Mike.


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

* Re: [RFC PATCH 2/2] mm/fake-numa: fix outdated return value comment
  2026-04-13 15:44 ` [RFC PATCH 2/2] mm/fake-numa: fix outdated return value comment Sang-Heon Jeon
@ 2026-04-14 12:37   ` Mike Rapoport
  0 siblings, 0 replies; 5+ messages in thread
From: Mike Rapoport @ 2026-04-14 12:37 UTC (permalink / raw)
  To: Sang-Heon Jeon; +Cc: akpm, djbw, mingo, linux-mm

Hi,

On Tue, Apr 14, 2026 at 12:44:38AM +0900, Sang-Heon Jeon wrote:
> split_nodes_size_interleave_uniform() returns absolute node ID when
> succeed, not zero.
> 
> Fix the outdated comment to match the actual return value.

This should be merged in the previous patch.
 
> Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
> ---
>  mm/numa_emulation.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/numa_emulation.c b/mm/numa_emulation.c
> index e7f856c8f2a1..c1d0a76aef64 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,
> -- 
> 2.43.0
> 

-- 
Sincerely yours,
Mike.


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

end of thread, other threads:[~2026-04-14 12:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-04-13 15:44 [RFC PATCH 0/2] mm/fake-numa: fix under-allocation detection logic in uniform split Sang-Heon Jeon
2026-04-13 15:44 ` [RFC PATCH 1/2] " Sang-Heon Jeon
2026-04-14 12:37   ` Mike Rapoport
2026-04-13 15:44 ` [RFC PATCH 2/2] mm/fake-numa: fix outdated return value comment Sang-Heon Jeon
2026-04-14 12:37   ` Mike Rapoport

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