* [PATCH] rt-numa: Correct the comment of numa_initialize()
@ 2021-12-23 14:01 Oscar Shiang
2021-12-23 16:03 ` Sebastian Andrzej Siewior
2021-12-25 16:43 ` John Kacur
0 siblings, 2 replies; 5+ messages in thread
From: Oscar Shiang @ 2021-12-23 14:01 UTC (permalink / raw)
To: jkacur, williams; +Cc: linux-rt-users, Oscar Shiang
numa_initialize() returns 0 only when numa_available() returns -1,
which means that libnuma is unavailable.
The return values in the comment should be corrected to 1 if all
functions are available and 0 when the functions are unavailable.
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..ee5ab99 100644
--- a/src/lib/rt-numa.c
+++ b/src/lib/rt-numa.c
@@ -15,7 +15,7 @@
/*
* numa_available() must be called before any other calls to the numa library
- * returns 0 if numa is available, or 1 if numa is not available
+ * returns 1 if numa is available, or 0 if numa is not available
*/
int numa_initialize(void)
{
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] rt-numa: Correct the comment of numa_initialize()
2021-12-23 14:01 [PATCH] rt-numa: Correct the comment of numa_initialize() Oscar Shiang
@ 2021-12-23 16:03 ` Sebastian Andrzej Siewior
2021-12-25 7:17 ` Oscar Shiang
2021-12-25 16:58 ` John Kacur
2021-12-25 16:43 ` John Kacur
1 sibling, 2 replies; 5+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-12-23 16:03 UTC (permalink / raw)
To: Oscar Shiang; +Cc: jkacur, williams, linux-rt-users
On 2021-12-23 22:01:07 [+0800], Oscar Shiang wrote:
> --- a/src/lib/rt-numa.c
> +++ b/src/lib/rt-numa.c
> @@ -15,7 +15,7 @@
>
> /*
> * numa_available() must be called before any other calls to the numa library
> - * returns 0 if numa is available, or 1 if numa is not available
> + * returns 1 if numa is available, or 0 if numa is not available
> */
To quote the man page:
Before any other calls in this library can be used numa_available()
must be called. If it returns -1, all other functions in this library
are undefined.
Based on that, neither 0 nor 1 is defined.
Sebastian
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] rt-numa: Correct the comment of numa_initialize()
2021-12-23 16:03 ` Sebastian Andrzej Siewior
@ 2021-12-25 7:17 ` Oscar Shiang
2021-12-25 16:58 ` John Kacur
1 sibling, 0 replies; 5+ messages in thread
From: Oscar Shiang @ 2021-12-25 7:17 UTC (permalink / raw)
To: bigeasy; +Cc: jkacur, linux-rt-users, oscar0225, williams
> Based on that, neither 0 nor 1 is defined.
Yes, it is.
But I think the comment is to describe the return value of numa_initialize()
not for numa_available().
That is also the reason why it has 0 and 1 as its return values.
Oscar
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] rt-numa: Correct the comment of numa_initialize()
2021-12-23 14:01 [PATCH] rt-numa: Correct the comment of numa_initialize() Oscar Shiang
2021-12-23 16:03 ` Sebastian Andrzej Siewior
@ 2021-12-25 16:43 ` John Kacur
1 sibling, 0 replies; 5+ messages in thread
From: John Kacur @ 2021-12-25 16:43 UTC (permalink / raw)
To: Oscar Shiang; +Cc: williams, linux-rt-users
On Thu, 23 Dec 2021, Oscar Shiang wrote:
> numa_initialize() returns 0 only when numa_available() returns -1,
> which means that libnuma is unavailable.
>
> The return values in the comment should be corrected to 1 if all
> functions are available and 0 when the functions are unavailable.
>
> 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..ee5ab99 100644
> --- a/src/lib/rt-numa.c
> +++ b/src/lib/rt-numa.c
> @@ -15,7 +15,7 @@
>
> /*
> * numa_available() must be called before any other calls to the numa library
> - * returns 0 if numa is available, or 1 if numa is not available
> + * returns 1 if numa is available, or 0 if numa is not available
> */
> int numa_initialize(void)
> {
> --
> 2.25.1
>
>
Signed-off-by: John Kacur <jkacur@redhat.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] rt-numa: Correct the comment of numa_initialize()
2021-12-23 16:03 ` Sebastian Andrzej Siewior
2021-12-25 7:17 ` Oscar Shiang
@ 2021-12-25 16:58 ` John Kacur
1 sibling, 0 replies; 5+ messages in thread
From: John Kacur @ 2021-12-25 16:58 UTC (permalink / raw)
To: Sebastian Andrzej Siewior; +Cc: Oscar Shiang, williams, linux-rt-users
On Thu, 23 Dec 2021, Sebastian Andrzej Siewior wrote:
> On 2021-12-23 22:01:07 [+0800], Oscar Shiang wrote:
> > --- a/src/lib/rt-numa.c
> > +++ b/src/lib/rt-numa.c
> > @@ -15,7 +15,7 @@
> >
> > /*
> > * numa_available() must be called before any other calls to the numa library
> > - * returns 0 if numa is available, or 1 if numa is not available
> > + * returns 1 if numa is available, or 0 if numa is not available
> > */
>
> To quote the man page:
>
> Before any other calls in this library can be used numa_available()
> must be called. If it returns -1, all other functions in this library
> are undefined.
>
> Based on that, neither 0 nor 1 is defined.
>
> Sebastian
>
Right, but the numa_initialize function is meant to wrap that in such a
way that we only call numa_available once, and then subsequent calls will
return 1 (or true) for numa is available or 0 (false) if it is not
available. This wrapper could probably be omitted, but it's supposed
to make the code more readable.
This still isn't entirely cleaned up after this functionality
was removed during the JSON stuff that mistakenly assumed numa is always
available at runtime. (it might not be for example on some embedded
platforms). In some case there might still be paths through the code that
don't call non-numa versions of the functions when numa is not available.
It's on my list to fix.
John
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-12-25 16:58 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-23 14:01 [PATCH] rt-numa: Correct the comment of numa_initialize() Oscar Shiang
2021-12-23 16:03 ` Sebastian Andrzej Siewior
2021-12-25 7:17 ` Oscar Shiang
2021-12-25 16:58 ` John Kacur
2021-12-25 16:43 ` John Kacur
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.