Re: [PATCH v2] cgroup/cpuset: Extend kthread_is_per_cpu() check to all PF_NO_SETAFFINITY tasks
From: Frederic Weisbecker
Date: Fri May 09 2025 - 17:20:55 EST
Le Fri, May 09, 2025 at 07:30:51AM -1000, Tejun Heo a écrit :
> Hello,
>
> On Fri, May 09, 2025 at 03:18:17PM +0200, Frederic Weisbecker wrote:
> ...
> > But this makes me realize I overlooked that when I introduced the unbound kthreads
> > centralized affinity.
> >
> > cpuset_update_tasks_cpumask() seem to blindly affine to subpartitions_cpus
> > while unbound kthreads might have their preferences (per-nodes or random cpumasks).
> >
> > So I need to make that pass through kthread API.
>
> I wonder whether it'd be cleaner if all kthread affinity restrictions go
> through housekeeping instead of cpuset modifying the cpumasks directly so
> that housekeeping keeps track of where different classes of kthreads can run
> and tell e.g. workqueue what to do.
Good suggestion. "isolated_cpus" should indeed be handled by housekeeping
itself. More precisely housekeeping_cpu(HK_TYPE_DOMAIN) should be updated
through some housekeeping_update() function to union the boot 'isolcpus='
and the isolated mask of cpusets partition. Waiman tried that at some point.
This will require some synchronization against the readers of HK_TYPE_DOMAIN.
It's beyond the scope of the kthreads affinity issue but yes that's all
planned within the cpusets integration of nohz_full.
Thanks.
>
> Thanks.
>
> --
> tejun
--
Frederic Weisbecker
SUSE Labs