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

From: Marcelo Tosatti
Date: Mon May 10 2021 - 12:23:57 EST


On Fri, May 07, 2021 at 10:16:00PM +0200, Frederic Weisbecker wrote:
> 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.

Hi Frederic,

Doh, yes, ignore me.