[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1b558608-6496-4078-afde-5f0e10086781@redhat.com>
Date: Thu, 8 May 2025 15:36:18 -0400
From: Waiman Long <llong@...hat.com>
To: Yury Norov <yury.norov@...il.com>, Tejun Heo <tj@...nel.org>,
Johannes Weiner <hannes@...xchg.org>, Michal Koutný
<mkoutny@...e.com>, cgroups@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] cgroup/cpuset: drop useless cpumask_empty() in
compute_effective_exclusive_cpumask()
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@...il.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@...hat.com>
Powered by blists - more mailing lists