Thanks for the answer and the context explanations. On Thu, Sep 02, 2021 at 12:00:33PM -0600, Jens Axboe <axboe@xxxxxxxxx> wrote: > We already have this API to set the affinity based on when these were > regular kernel threads, so it needs to work with that too. As such they > are marked PF_NO_SETAFFINITY. I see the current implementation "allows" at most one binding (by the passed sq_cpu arg) to a CPU and then "locks" it by setting PF_NO_SETAFFINITY subsequently (after set_cpus_allowed_ptr). And actually doesn't check whether it succeeded or not (Hao suggests in another subthread sq_cpu is a mere hint). Nevertheless, you likely don't want to "trespass" the boundary of a cpuset and I think that it'll end up with a loop checking against hotplug races. That is already implemented in __sched_affinity, it'd be IMO good to have it in one place only. > > [1] Not only spending their life in kernel but providing some > > delocalized kernel service. > > That's what they do... (I assume that answer to "life in kernel" and the IO threads serve only the originating cpuset (container) i.e. are (co)localized to it (not delocalized as some kernel workers).) Cheers, Michal