mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Waiman Long <llong@redhat.com>
To: "Yury Norov" <yury.norov@gmail.com>, "Tejun Heo" <tj@kernel.org>,
	"Johannes Weiner" <hannes@cmpxchg.org>,
	"Michal Koutný" <mkoutny@suse.com>,
	cgroups@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] cgroup/cpuset: drop useless cpumask_empty() in compute_effective_exclusive_cpumask()
Date: Thu, 8 May 2025 15:36:18 -0400	[thread overview]
Message-ID: <1b558608-6496-4078-afde-5f0e10086781@redhat.com> (raw)
In-Reply-To: <20250508193207.388041-1-yury.norov@gmail.com>

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>


  reply	other threads:[~2025-05-08 19:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-08 19:32 Yury Norov
2025-05-08 19:36 ` Waiman Long [this message]
2025-05-09 17:32 ` Tejun Heo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1b558608-6496-4078-afde-5f0e10086781@redhat.com \
    --to=llong@redhat.com \
    --cc=cgroups@vger.kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkoutny@suse.com \
    --cc=tj@kernel.org \
    --cc=yury.norov@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®