* [PATCH] cgroup/cpuset: drop useless cpumask_empty() in compute_effective_exclusive_cpumask()
@ 2025-05-08 19:32 Yury Norov
2025-05-08 19:36 ` Waiman Long
2025-05-09 17:32 ` Tejun Heo
0 siblings, 2 replies; 3+ messages in thread
From: Yury Norov @ 2025-05-08 19:32 UTC (permalink / raw)
To: Waiman Long, Tejun Heo, Johannes Weiner, Michal Koutný,
cgroups, linux-kernel
Cc: Yury Norov
Empty cpumasks can't intersect with any others. Therefore, testing for
non-emptyness is useless.
Signed-off-by: Yury Norov <yury.norov@gmail.com>
---
kernel/cgroup/cpuset.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index 306b60430091..df308072f268 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -1388,14 +1388,12 @@ static int compute_effective_exclusive_cpumask(struct cpuset *cs,
if (sibling == cs)
continue;
- if (!cpumask_empty(sibling->exclusive_cpus) &&
- cpumask_intersects(xcpus, sibling->exclusive_cpus)) {
+ if (cpumask_intersects(xcpus, sibling->exclusive_cpus)) {
cpumask_andnot(xcpus, xcpus, sibling->exclusive_cpus);
retval++;
continue;
}
- if (!cpumask_empty(sibling->effective_xcpus) &&
- cpumask_intersects(xcpus, sibling->effective_xcpus)) {
+ if (cpumask_intersects(xcpus, sibling->effective_xcpus)) {
cpumask_andnot(xcpus, xcpus, sibling->effective_xcpus);
retval++;
}
--
2.43.0
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] cgroup/cpuset: drop useless cpumask_empty() in compute_effective_exclusive_cpumask()
2025-05-08 19:32 [PATCH] cgroup/cpuset: drop useless cpumask_empty() in compute_effective_exclusive_cpumask() Yury Norov
@ 2025-05-08 19:36 ` Waiman Long
2025-05-09 17:32 ` Tejun Heo
1 sibling, 0 replies; 3+ messages in thread
From: Waiman Long @ 2025-05-08 19:36 UTC (permalink / raw)
To: Yury Norov, Tejun Heo, Johannes Weiner, Michal Koutný,
cgroups, linux-kernel
On 5/8/25 3:32 PM, Yury Norov wrote:
> Empty cpumasks can't intersect with any others. Therefore, testing for
> non-emptyness is useless.
>
> Signed-off-by: Yury Norov <yury.norov@gmail.com>
> ---
> kernel/cgroup/cpuset.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
> index 306b60430091..df308072f268 100644
> --- a/kernel/cgroup/cpuset.c
> +++ b/kernel/cgroup/cpuset.c
> @@ -1388,14 +1388,12 @@ static int compute_effective_exclusive_cpumask(struct cpuset *cs,
> if (sibling == cs)
> continue;
>
> - if (!cpumask_empty(sibling->exclusive_cpus) &&
> - cpumask_intersects(xcpus, sibling->exclusive_cpus)) {
> + if (cpumask_intersects(xcpus, sibling->exclusive_cpus)) {
> cpumask_andnot(xcpus, xcpus, sibling->exclusive_cpus);
> retval++;
> continue;
> }
> - if (!cpumask_empty(sibling->effective_xcpus) &&
> - cpumask_intersects(xcpus, sibling->effective_xcpus)) {
> + if (cpumask_intersects(xcpus, sibling->effective_xcpus)) {
> cpumask_andnot(xcpus, xcpus, sibling->effective_xcpus);
> retval++;
> }
You are right. Non-emptiness check is useless.
Reviewed-by: Waiman Long <longman@redhat.com>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] cgroup/cpuset: drop useless cpumask_empty() in compute_effective_exclusive_cpumask()
2025-05-08 19:32 [PATCH] cgroup/cpuset: drop useless cpumask_empty() in compute_effective_exclusive_cpumask() Yury Norov
2025-05-08 19:36 ` Waiman Long
@ 2025-05-09 17:32 ` Tejun Heo
1 sibling, 0 replies; 3+ messages in thread
From: Tejun Heo @ 2025-05-09 17:32 UTC (permalink / raw)
To: Yury Norov
Cc: Waiman Long, Johannes Weiner, Michal Koutný, cgroups, linux-kernel
On Thu, May 08, 2025 at 03:32:06PM -0400, Yury Norov wrote:
> Empty cpumasks can't intersect with any others. Therefore, testing for
> non-emptyness is useless.
>
> Signed-off-by: Yury Norov <yury.norov@gmail.com>
Applied to cgroup/for-6.16.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-05-09 17:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-05-08 19:32 [PATCH] cgroup/cpuset: drop useless cpumask_empty() in compute_effective_exclusive_cpumask() Yury Norov
2025-05-08 19:36 ` Waiman Long
2025-05-09 17:32 ` Tejun Heo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®