Re: [patch V4 16/20] sched/mmcid: Provide new scheduler CID mechanism
From: Mathieu Desnoyers
Date: Mon Nov 17 2025 - 14:41:07 EST
On 2025-11-16 15:49, Thomas Gleixner wrote:
[...]
The current upstream implementation tries to keep the CID with the task
even in overcommit situations, which complicates task migration. It also
has to do the CID space consolidation work from a task work in the exit to
user space path. As that work is assigned to a random task related to a MM
this can inflict unwanted exit latencies.
Implement the context switch parts of a strict ownership mechanism to
address this.
This removes most of the work from the task which schedules out. Only
during transitioning from per CPU to per task ownership it is required to
drop the CID when leaving the CPU to prevent CID space exhaustion. Other
than that scheduling out is just a single check and branch.
Same comment as for prior patch.
[...]
struct mm_mm_cid {
+ /* Hotpath read mostly members */
struct mm_cid_pcpu __percpu *pcpu;
+ unsigned int percpu;
+ unsigned int transit;
[...]
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -10495,6 +10495,7 @@ void mm_init_cid(struct mm_struct *mm, s
per_cpu_ptr(pcpu, cpu)->cid = MM_CID_UNSET;
mm->mm_cid.max_cids = 0;
+ mm->mm_cid.percpu = 0;
I'm unsure where it appears (maybe later in the series ?), but
I would have expected:
mm->mm_cid.transit = 0;
here.
Other than those comments:
Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxxxx>
--
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com