mm/fake-numa: fix under-allocation detection logic in uniform split
cover mm/fake-numa: fix under-allocation detection logic in uniform split
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(-)
Signature · 1 line
2.43.0
RFC PATCH 1/2 mm/fake-numa: fix under-allocation detection logic in uniform split
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).
--- mm/numa_emulation.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/numa_emulation.c +1 -1
@@ -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 ;
Signature · 1 line
2.43.0
Mike Rapoport
maintainerHi,
Quoted 4 lines · Sang-Heon Jeon
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"
Quoted 4 lines
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.
Quoted 24 lines
Signed-off-by Sang-Heon Jeon <[email protected]>Reported-by Donghyeon Lee <[email protected]>Reported-by Munhui Chae <[email protected]>Fixes cc9aec03e58f ("x86/numa_emulation: Introduce uniform split capability") # 4.19--- mm/numa_emulation.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/numa_emulation.c +1
-1@@ -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 ;Signature · 1 line
2.43.0
Signature · 2 lines
Sincerely yours, Mike.
Hello, Mike
Quoted 10 lines · Mike Rapoport
Hi,
Quoted 4 lines · Sang-Heon Jeon
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"
That's good :) I'll replace it.
Quoted 7 lines
Quoted 4 lines
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.
Sure, I'll add it.
Quoted 20 lines
Quoted 20 lines
Signed-off-by Sang-Heon Jeon <[email protected]>Reported-by Donghyeon Lee <[email protected]>Reported-by Munhui Chae <[email protected]>Fixes cc9aec03e58f ("x86/numa_emulation: Introduce uniform split capability") # 4.19--- mm/numa_emulation.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/numa_emulation.c +1
-1@@ -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);
Quoted 8 lines
Quoted 4 lines
mm/numa_emulation.c +0
-1ret =-1 ; --2.43.0
--
Sincerely yours,
Mike.
Thanks for your kind review.
Best Regards,
Sang-Heon Jeon
RFC PATCH 2/2 mm/fake-numa: fix outdated return value comment
In reply to Sang-Heon Jeonsplit_nodes_size_interleave_uniform() returns absolute node ID when succeed, not zero.
Fix the outdated comment to match the actual return value.
--- mm/numa_emulation.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/numa_emulation.c +1 -1
@@ -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,
Signature · 1 line
2.43.0
Mike Rapoport
maintainerRe: [RFC PATCH 2/2] mm/fake-numa: fix outdated return value comment
Hi,
Quoted 4 lines · 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.
This should be merged in the previous patch.
Quoted 21 lines
Signed-off-by Sang-Heon Jeon <[email protected]>--- mm/numa_emulation.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/numa_emulation.c +1
-1@@ -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,Signature · 1 line
2.43.0
Signature · 2 lines
Sincerely yours, Mike.
Re: [RFC PATCH 2/2] mm/fake-numa: fix outdated return value comment
Hello,
Quoted 10 lines · Mike Rapoport
Hi,
Quoted 4 lines · 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.
This should be merged in the previous patch.
I got it. I'll include it in the v2 patch.
Quoted 17 lines
Quoted 17 lines
Signed-off-by Sang-Heon Jeon <[email protected]>--- mm/numa_emulation.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/numa_emulation.c +1
-1@@ -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,
Quoted 8 lines
Quoted 4 lines
mm/numa_emulation.c +0
-1struct numa_meminfo *pi, --2.43.0
--
Sincerely yours,
Mike.
Best Regards,
Sang-Heon Jeon