linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH 1/2] cpuset: Fix cpuset_cpus_allowed() to not filter offline CPUs
       [not found] ` <20230131221719.3176-2-will@kernel.org>
@ 2023-02-01 10:23   ` Hillf Danton
  0 siblings, 0 replies; only message in thread
From: Hillf Danton @ 2023-02-01 10:23 UTC (permalink / raw)
  To: Will Deacon; +Cc: linux-kernel, linux-mm, Peter Zijlstra, Waiman Long

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-02-01 10:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20230131221719.3176-1-will@kernel.org>
     [not found] ` <20230131221719.3176-2-will@kernel.org>
2023-02-01 10:23   ` [PATCH 1/2] cpuset: Fix cpuset_cpus_allowed() to not filter offline CPUs Hillf Danton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox