summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2025-11-19 20:27:11 +0300
committerThomas Gleixner <tglx@linutronix.de>2025-11-25 21:45:41 +0300
commit51dd92c71a38647803478fb81e1812286a8998b1 (patch)
tree9307edac0d7b5e58d362cffe824bc726c2103113 /include/linux
parentb0c3d51b54f8a4f4c809432d210c0c983d5cd97e (diff)
downloadlinux-51dd92c71a38647803478fb81e1812286a8998b1.tar.xz
sched/mmcid: Serialize sched_mm_cid_fork()/exit() with a mutex
Prepare for the new CID management scheme which puts the CID ownership transition into the fork() and exit() slow path by serializing sched_mm_cid_fork()/exit() with it, so task list and cpu mask walks can be done in interruptible and preemptible code. The contention on it is not worse than on other concurrency controls in the fork()/exit() machinery. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Link: https://patch.msgid.link/20251119172549.895826703@linutronix.de
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/rseq_types.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/rseq_types.h b/include/linux/rseq_types.h
index 0fab369999b6..574aba6fe97c 100644
--- a/include/linux/rseq_types.h
+++ b/include/linux/rseq_types.h
@@ -125,6 +125,7 @@ struct mm_cid_pcpu {
* do not actually share the MM.
* @lock: Spinlock to protect all fields except @pcpu. It also protects
* the MM cid cpumask and the MM cidmask bitmap.
+ * @mutex: Mutex to serialize forks and exits related to this mm
*/
struct mm_mm_cid {
struct mm_cid_pcpu __percpu *pcpu;
@@ -132,6 +133,7 @@ struct mm_mm_cid {
unsigned int nr_cpus_allowed;
unsigned int users;
raw_spinlock_t lock;
+ struct mutex mutex;
}____cacheline_aligned_in_smp;
#else /* CONFIG_SCHED_MM_CID */
struct mm_mm_cid { };