Re: [PATCH 02/17] sched/mmcid: Give no concurrency ID to user workers
From: Thomas Gleixner
Date: Sun Nov 29 2026 - 16:55:00 EST
On Tue, Nov 17 2026 at 11:17, Mathieu Desnoyers wrote:
> The workers of io_uring and vhost are PF_USER_WORKER tasks. They are
> threads of the process they work for, created with CLONE_VM. They only
> run kernel code: copy_process() gives them a kernel function that ends
> in do_exit(). They never return to user space and have no rseq area.
>
> sched_mm_cid_fork() still makes them users of the CIDs of the mm, like
> every task with an mm. A worker takes a CID whenever it runs. It also
> counts as a user for max_cids and for the switch to per CPU mode.
>
> Nothing reports the CID of a worker. But it is one CID fewer for the
> threads of the process, which then get larger ones. The added users can
> also switch the mm to per CPU mode. A process with io_uring workers
> would then read mm_cid values at or above its number of threads. This
> was found by reading the code, and has no test.
>
> Fix this by not making a user worker a user of the CIDs. Kernel threads
> are already left out, as they have no mm.
>
> Fixes: af7f588d8f73 ("sched: Introduce per-memory-map concurrency ID")
That's not a fix. That's an optimization and has zero impact on
correctness.
Thanks,
tglx