lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Zy5eadwAuQSzqp-1@slm.duckdns.org>
Date: Fri, 8 Nov 2024 08:54:33 -1000
From: Tejun Heo <tj@...nel.org>
To: Nathan Chancellor <nathan@...nel.org>
Cc: Andrea Righi <arighi@...dia.com>, David Vernet <void@...ifault.com>,
	linux-kernel@...r.kernel.org, llvm@...ts.linux.dev
Subject: Re: [PATCH v3 sched_ext/for-6.13] sched_ext: Do not enable LLC/NUMA
 optimizations when domains overlap

On Fri, Nov 08, 2024 at 11:17:53AM -0700, Nathan Chancellor wrote:
> Hi Andrea,
> 
> On Fri, Nov 08, 2024 at 01:01:36AM +0100, Andrea Righi wrote:
> ...
> > +	/*
> > +	 * Enable NUMA optimization only when there are multiple NUMA domains
> > +	 * among the online CPUs and the NUMA domains don't perfectly overlaps
> > +	 * with the LLC domains.
> > +	 *
> > +	 * If all CPUs belong to the same NUMA node and the same LLC domain,
> > +	 * enabling both NUMA and LLC optimizations is unnecessary, as checking
> > +	 * for an idle CPU in the same domain twice is redundant.
> > +	 */
> > +	cpus = cpumask_of_node(cpu_to_node(cpu));
> > +	if ((cpumask_weight(cpus) < num_online_cpus()) & llc_numa_mismatch())
> > +		enable_numa = true;
> 
> With this hunk in next-20241108, I am seeing a clang warning (or error
> since CONFIG_WERROR=y):
> 
>   In file included from kernel/sched/build_policy.c:63:
>   kernel/sched/ext.c:3252:6: error: use of bitwise '&' with boolean operands [-Werror,-Wbitwise-instead-of-logical]
>    3252 |         if ((cpumask_weight(cpus) < num_online_cpus()) & llc_numa_mismatch())
>         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>         |                                                        &&
>   kernel/sched/ext.c:3252:6: note: cast one or both operands to int to silence this warning
>   1 error generated.
> 
> Was use of a bitwise AND here intentional (i.e., should
> llc_num_mismatch() always be called regardless of the outcome of the
> first condition) or can it be switched to a logical AND to silence the
> warning? I do not mind sending a patch but I did not want to be wrong
> off bat. If there is some other better solution that I am not seeing,
> please feel free to send a patch with this as just a report.

Oops, that looks like a mistake. I don't see why it can't be &&.

Thanks.

-- 
tejun

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ