[PATCH v8 06/19] cpuset: Don't use the cpu_possible_mask as a last resort for cgroup v1

Valentin Schneider valentin.schneider at arm.com
Thu Jun 10 03:20:09 PDT 2021


On 07/06/21 18:20, Will Deacon wrote:
> On Fri, Jun 04, 2021 at 06:11:03PM +0100, Valentin Schneider wrote:
>> On 02/06/21 17:47, Will Deacon wrote:
>> > @@ -3322,9 +3322,13 @@ void cpuset_cpus_allowed(struct task_struct *tsk, struct cpumask *pmask)
>> >
>> >  void cpuset_cpus_allowed_fallback(struct task_struct *tsk)
>> >  {
>> > +	const struct cpumask *cs_mask;
>> > +	const struct cpumask *possible_mask = task_cpu_possible_mask(tsk);
>> > +
>> >       rcu_read_lock();
>> > -	do_set_cpus_allowed(tsk, is_in_v2_mode() ?
>> > -		task_cs(tsk)->cpus_allowed : cpu_possible_mask);
>> > +	cs_mask = task_cs(tsk)->cpus_allowed;
>> > +	if (is_in_v2_mode() && cpumask_subset(cs_mask, possible_mask))
>> > +		do_set_cpus_allowed(tsk, cs_mask);
>>
>> Since the task will still go through the is_cpu_allowed() loop in
>> select_fallback_rq() after this, is the subset check actually required
>> here?
>
> Yes, I think it's needed. do_set_cpus_allowed() doesn't do any checking
> against the task_cpu_possible_mask, so if we returned to
> select_fallback_rq() with a mask containing a mixture of 32-bit-capable and
> 64-bit-only CPUs then we'd end up setting an affinity mask for a 32-bit
> task which contains 64-bit-only cores.
>

Once again, you're right :-)



More information about the linux-arm-kernel mailing list