* Re: [PATCH v3 sched_ext/for-6.13] sched_ext: Do not enable LLC/NUMA optimizations when domains overlap
[not found] <20241108000136.184909-1-arighi@nvidia.com>
@ 2024-11-08 18:17 ` Nathan Chancellor
2024-11-08 18:54 ` Tejun Heo
0 siblings, 1 reply; 5+ messages in thread
From: Nathan Chancellor @ 2024-11-08 18:17 UTC (permalink / raw)
To: Andrea Righi; +Cc: Tejun Heo, David Vernet, linux-kernel, llvm
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.
Cheers,
Nathan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3 sched_ext/for-6.13] sched_ext: Do not enable LLC/NUMA optimizations when domains overlap
2024-11-08 18:17 ` [PATCH v3 sched_ext/for-6.13] sched_ext: Do not enable LLC/NUMA optimizations when domains overlap Nathan Chancellor
@ 2024-11-08 18:54 ` Tejun Heo
2024-11-08 19:39 ` Andrea Righi
0 siblings, 1 reply; 5+ messages in thread
From: Tejun Heo @ 2024-11-08 18:54 UTC (permalink / raw)
To: Nathan Chancellor; +Cc: Andrea Righi, David Vernet, linux-kernel, llvm
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3 sched_ext/for-6.13] sched_ext: Do not enable LLC/NUMA optimizations when domains overlap
2024-11-08 18:54 ` Tejun Heo
@ 2024-11-08 19:39 ` Andrea Righi
2024-11-08 19:42 ` Tejun Heo
0 siblings, 1 reply; 5+ messages in thread
From: Andrea Righi @ 2024-11-08 19:39 UTC (permalink / raw)
To: Tejun Heo; +Cc: Nathan Chancellor, David Vernet, linux-kernel, llvm
On Fri, Nov 08, 2024 at 08:54:33AM -1000, Tejun Heo wrote:
> 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 &&.
Sorry, this is a mistake, it definitely needs to be &&.
Do you want me to send a fix on top of this one or a v4?
Thanks,
-Andrea
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3 sched_ext/for-6.13] sched_ext: Do not enable LLC/NUMA optimizations when domains overlap
2024-11-08 19:39 ` Andrea Righi
@ 2024-11-08 19:42 ` Tejun Heo
2024-11-08 19:54 ` Andrea Righi
0 siblings, 1 reply; 5+ messages in thread
From: Tejun Heo @ 2024-11-08 19:42 UTC (permalink / raw)
To: Andrea Righi; +Cc: Nathan Chancellor, David Vernet, linux-kernel, llvm
On Fri, Nov 08, 2024 at 08:39:15PM +0100, Andrea Righi wrote:
> Sorry, this is a mistake, it definitely needs to be &&.
>
> Do you want me to send a fix on top of this one or a v4?
An incremental fix patch would be great.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3 sched_ext/for-6.13] sched_ext: Do not enable LLC/NUMA optimizations when domains overlap
2024-11-08 19:42 ` Tejun Heo
@ 2024-11-08 19:54 ` Andrea Righi
0 siblings, 0 replies; 5+ messages in thread
From: Andrea Righi @ 2024-11-08 19:54 UTC (permalink / raw)
To: Tejun Heo; +Cc: Nathan Chancellor, David Vernet, linux-kernel, llvm
On Fri, Nov 08, 2024 at 09:42:44AM -1000, Tejun Heo wrote:
> External email: Use caution opening links or attachments
>
>
> On Fri, Nov 08, 2024 at 08:39:15PM +0100, Andrea Righi wrote:
> > Sorry, this is a mistake, it definitely needs to be &&.
> >
> > Do you want me to send a fix on top of this one or a v4?
>
> An incremental fix patch would be great.
>
> Thanks.
Sent. Thanks Nathan for noticing it!
-Andrea
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-11-08 19:54 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20241108000136.184909-1-arighi@nvidia.com>
2024-11-08 18:17 ` [PATCH v3 sched_ext/for-6.13] sched_ext: Do not enable LLC/NUMA optimizations when domains overlap Nathan Chancellor
2024-11-08 18:54 ` Tejun Heo
2024-11-08 19:39 ` Andrea Righi
2024-11-08 19:42 ` Tejun Heo
2024-11-08 19:54 ` Andrea Righi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox