Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

signal: Move MMCID exit out of sighand lock

There is no need anymore to keep this under sighand lock as the current
code and the upcoming replacement are not depending on the exit state of a
task anymore.

That allows to use a mutex in the exit path.

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.706439391@linutronix.de

+5 -6
+2 -2
include/linux/sched.h
··· 2298 2298 void sched_mm_cid_before_execve(struct task_struct *t); 2299 2299 void sched_mm_cid_after_execve(struct task_struct *t); 2300 2300 void sched_mm_cid_fork(struct task_struct *t); 2301 - void sched_mm_cid_exit_signals(struct task_struct *t); 2301 + void sched_mm_cid_exit(struct task_struct *t); 2302 2302 static inline int task_mm_cid(struct task_struct *t) 2303 2303 { 2304 2304 return t->mm_cid.cid; ··· 2307 2307 static inline void sched_mm_cid_before_execve(struct task_struct *t) { } 2308 2308 static inline void sched_mm_cid_after_execve(struct task_struct *t) { } 2309 2309 static inline void sched_mm_cid_fork(struct task_struct *t) { } 2310 - static inline void sched_mm_cid_exit_signals(struct task_struct *t) { } 2310 + static inline void sched_mm_cid_exit(struct task_struct *t) { } 2311 2311 static inline int task_mm_cid(struct task_struct *t) 2312 2312 { 2313 2313 /*
+1
kernel/exit.c
··· 910 910 user_events_exit(tsk); 911 911 912 912 io_uring_files_cancel(); 913 + sched_mm_cid_exit(tsk); 913 914 exit_signals(tsk); /* sets PF_EXITING */ 914 915 915 916 seccomp_filter_release(tsk);
+2 -2
kernel/sched/core.c
··· 10392 10392 WRITE_ONCE(mm->mm_cid.nr_cpus_allowed, weight); 10393 10393 } 10394 10394 10395 - void sched_mm_cid_exit_signals(struct task_struct *t) 10395 + void sched_mm_cid_exit(struct task_struct *t) 10396 10396 { 10397 10397 struct mm_struct *mm = t->mm; 10398 10398 ··· 10410 10410 /* Deactivate MM CID allocation across execve() */ 10411 10411 void sched_mm_cid_before_execve(struct task_struct *t) 10412 10412 { 10413 - sched_mm_cid_exit_signals(t); 10413 + sched_mm_cid_exit(t); 10414 10414 } 10415 10415 10416 10416 /* Reactivate MM CID after successful execve() */
-2
kernel/signal.c
··· 3125 3125 cgroup_threadgroup_change_begin(tsk); 3126 3126 3127 3127 if (thread_group_empty(tsk) || (tsk->signal->flags & SIGNAL_GROUP_EXIT)) { 3128 - sched_mm_cid_exit_signals(tsk); 3129 3128 tsk->flags |= PF_EXITING; 3130 3129 cgroup_threadgroup_change_end(tsk); 3131 3130 return; ··· 3135 3136 * From now this task is not visible for group-wide signals, 3136 3137 * see wants_signal(), do_signal_stop(). 3137 3138 */ 3138 - sched_mm_cid_exit_signals(tsk); 3139 3139 tsk->flags |= PF_EXITING; 3140 3140 3141 3141 cgroup_threadgroup_change_end(tsk);