Re: [PATCH] rt-numa: Fix the value to check in numa_initialize()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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@xxxxxxxxxxx>
> ---
>  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




[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux