Re: [PATCH] Revert "isolcpus: Affine unbound kernel threads to housekeeping cpus"

From: Frederic Weisbecker
Date: Fri May 07 2021 - 16:16:09 EST


On Fri, May 07, 2021 at 01:57:10PM -0300, Marcelo Tosatti wrote:
>
>
> commit 9cc5b8656892a72438ee7deb introduced a new housekeeping flag,
> HK_FLAG_KTHREAD, that when enabled sets the CPU affinity for the
> kthreadd process (therefore all unbounded kernel threads created
> from that point on will use the housekeeping cpumask).
>
> This is not necessary, since its possible to control placement of
> kthreadd from userspace:
>
> # taskset -c -p 0 `pgrep kthreadd`
> pid 2's current affinity list: 1
> pid 2's new affinity list: 0
>
> Unbounded kernel threads started from that point on will inherit
> the kthreadd cpumask.

Hmm, but look below:

> @@ -405,8 +404,7 @@ struct task_struct *__kthread_create_on_
> * The kernel thread should not inherit these properties.
> */
> sched_setscheduler_nocheck(task, SCHED_NORMAL, &param);
> - set_cpus_allowed_ptr(task,
> - housekeeping_cpumask(HK_FLAG_KTHREAD));
> + set_cpus_allowed_ptr(task, cpu_possible_mask);

That inheritance is then overriden, right?

Thanks.