linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Hillf Danton <hdanton@sina.com>
To: Will Deacon <will@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	Peter Zijlstra <peterz@infradead.org>,
	Waiman Long <longman@redhat.com>
Subject: Re: [PATCH 1/2] cpuset: Fix cpuset_cpus_allowed() to not filter offline CPUs
Date: Wed,  1 Feb 2023 18:23:53 +0800	[thread overview]
Message-ID: <20230201102353.374-1-hdanton@sina.com> (raw)
In-Reply-To: <20230131221719.3176-2-will@kernel.org>

On Tue, 31 Jan 2023 22:17:18 +0000 Will Deacon <will@kernel.org>
>  
> +static const struct cpumask *__cs_cpus_allowed(struct cpuset *cs)
> +{
> +	const struct cpumask *cs_mask = cs->cpus_allowed;
> +	if (!parent_cs(cs))
> +		cs_mask = cpu_possible_mask;
> +	return cs_mask;
> +}
> +
> +static void cs_cpus_allowed(struct cpuset *cs, struct cpumask *pmask)
> +{
> +	do {
> +		cpumask_and(pmask, pmask, __cs_cpus_allowed(cs));
> +		cs = parent_cs(cs);
> +	} while (cs);
> +}

If it is not typo, why is it needed here to spiral the cs hierarchy up,
given the same spiralup below?

>  void cpuset_cpus_allowed(struct task_struct *tsk, struct cpumask *pmask)
>  {
>  	unsigned long flags;
> +	struct cpuset *cs;
>  
>  	spin_lock_irqsave(&callback_lock, flags);
> -	guarantee_online_cpus(tsk, pmask);
> +	rcu_read_lock();
> +
> +	cs = task_cs(tsk);
> +	do {
> +		cpumask_copy(pmask, task_cpu_possible_mask(tsk));
> +		cs_cpus_allowed(cs, pmask);
> +
> +		if (cpumask_intersects(pmask, cpu_online_mask))
> +			break;
> +
> +		cs = parent_cs(cs);
> +	} while (cs);
> +
> +	rcu_read_unlock();
>  	spin_unlock_irqrestore(&callback_lock, flags);
>  }
>  
> -- 
> 2.39.1.456.gfc5497dd1b-goog


           reply	other threads:[~2023-02-01 10:24 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20230131221719.3176-2-will@kernel.org>]

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=20230201102353.374-1-hdanton@sina.com \
    --to=hdanton@sina.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=longman@redhat.com \
    --cc=peterz@infradead.org \
    --cc=will@kernel.org \
    /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