All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rt-numa: Fix the value to check in numa_initialize()
@ 2021-12-22  6:28 Oscar Shiang
  2021-12-22 15:45 ` John Kacur
  0 siblings, 1 reply; 3+ messages in thread
From: Oscar Shiang @ 2021-12-22  6:28 UTC (permalink / raw)
  To: linux-rt-users; +Cc: jkacur, williams, Oscar Shiang

According to numa(3) [1], all numa functions are undefined if
numa_available() returns -1.

Thus numa_initialize() should not return 0, which indicates
libnuma is available, if numa_available() returns -1. It should
return 1 instead.

[1]: https://man7.org/linux/man-pages/man3/numa.3.html

Signed-off-by: Oscar Shiang <oscar0225@livemail.tw>
---
 src/lib/rt-numa.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lib/rt-numa.c b/src/lib/rt-numa.c
index bb0121a..47a643e 100644
--- a/src/lib/rt-numa.c
+++ b/src/lib/rt-numa.c
@@ -25,7 +25,7 @@ int numa_initialize(void)
 	if (is_initialized == 1)
 		return numa;
 
-	if (numa_available() != -1)
+	if (numa_available() == -1)
 		numa = 1;
 
 	is_initialized = 1;
-- 
2.25.1


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

* Re: [PATCH] rt-numa: Fix the value to check in numa_initialize()
  2021-12-22  6:28 [PATCH] rt-numa: Fix the value to check in numa_initialize() Oscar Shiang
@ 2021-12-22 15:45 ` John Kacur
  2021-12-23  6:29   ` 向 景亘
  0 siblings, 1 reply; 3+ messages in thread
From: John Kacur @ 2021-12-22 15:45 UTC (permalink / raw)
  To: Oscar Shiang; +Cc: linux-rt-users, williams



On Wed, 22 Dec 2021, Oscar Shiang wrote:

> According to numa(3) [1], all numa functions are undefined if
> numa_available() returns -1.
> 
> Thus numa_initialize() should not return 0, which indicates
> libnuma is available, if numa_available() returns -1. It should
> return 1 instead.
> 
> [1]: https://man7.org/linux/man-pages/man3/numa.3.html
> 
> Signed-off-by: Oscar Shiang <oscar0225@livemail.tw>
> ---
>  src/lib/rt-numa.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/lib/rt-numa.c b/src/lib/rt-numa.c
> index bb0121a..47a643e 100644
> --- a/src/lib/rt-numa.c
> +++ b/src/lib/rt-numa.c
> @@ -25,7 +25,7 @@ int numa_initialize(void)
>  	if (is_initialized == 1)
>  		return numa;
>  
> -	if (numa_available() != -1)
> +	if (numa_available() == -1)
>  		numa = 1;
>  
>  	is_initialized = 1;
> -- 
> 2.25.1
> 
> 

No, it looks to me like the code is correct but the comment is incorrect.
If you submit a patch fixing the comment, I'll apply it.

Thanks

John


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

* Re: [PATCH] rt-numa: Fix the value to check in numa_initialize()
  2021-12-22 15:45 ` John Kacur
@ 2021-12-23  6:29   ` 向 景亘
  0 siblings, 0 replies; 3+ messages in thread
From: 向 景亘 @ 2021-12-23  6:29 UTC (permalink / raw)
  To: John Kacur; +Cc: linux-rt-users, Clark Williams



> On Dec 22, 2021, at 11:45 PM, John Kacur <jkacur@redhat.com> wrote:
> 
> No, it looks to me like the code is correct but the comment is incorrect.
> If you submit a patch fixing the comment, I'll apply it.
> 

I agree. I will send another patch to fix the comment.

Thanks

Oscar

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

end of thread, other threads:[~2021-12-23  6:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-22  6:28 [PATCH] rt-numa: Fix the value to check in numa_initialize() Oscar Shiang
2021-12-22 15:45 ` John Kacur
2021-12-23  6:29   ` 向 景亘

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.