[patch V5 00/20] sched: Rewrite MM CID management

From: Thomas Gleixner

Date: Wed Nov 19 2025 - 12:26:46 EST


This is a follow up on the V4 series which can be found here:

https://lore.kernel.org/20251104075053.700034556@xxxxxxxxxxxxx

The V1 cover letter contains a detailed analyisis of the issues:

https://lore.kernel.org/20251015164952.694882104@xxxxxxxxxxxxx

TLDR: The CID management is way to complex and adds significant overhead
into scheduler hotpaths.

The series rewrites MM CID management in a more simplistic way which
focusses on low overhead in the scheduler while maintaining per task CIDs
as long as the number of threads is not exceeding the number of possible
CPUs.

The series is based on the V6 series of the rseq rewrite:

https://lore.kernel.org/20251027084220.785525188@xxxxxxxxxxxxx

which is also available from git:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git core/rseq

The series on top of the tip core/rseq branch is available from git as
well:

git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git rseq/cid

Changes vs. V4:

- Zero mm_cid::transit on init - Mathieu

- Rephrase change logs - Mathiue

- Picked up Reviewed/Acked-by tags

Delta patch to V4 below.

Thanks,

tglx
---
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 93a2523908c4..72f368f7d6e2 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -10848,6 +10848,7 @@ void mm_init_cid(struct mm_struct *mm, struct task_struct *p)
{
mm->mm_cid.max_cids = 0;
mm->mm_cid.percpu = 0;
+ mm->mm_cid.transit = 0;
mm->mm_cid.nr_cpus_allowed = p->nr_cpus_allowed;
mm->mm_cid.users = 0;
mm->mm_cid.pcpu_thrs = 0;