From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 610BA369984 for ; Wed, 19 Nov 2025 17:27:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763573232; cv=none; b=WA9oZyhUGWxUIfQGONq3j7unLpJGD3S5sl2OmQ3FffIV8905q1SpkRYAmKyv7KuIrdiP3audCvQfz+3oq1s2WLOq5+UQzSyy2QY/O6wnyElPJ3eG+CMAHxKhEdZ6EC/OQQ9cYB+GJrRsDDQibDIeWbdOEZDkd8lYSVCo61obes0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763573232; c=relaxed/simple; bh=eqqrk42z+m0EAC2m8M2fnAj1CrMQAYFseVwhfFIeDEA=; h=Message-ID:From:To:Cc:Subject:References:MIME-Version: Content-Type:Date; b=iefsYCTW8QlyHFxDnchsR0xipl7U9IFWH+E6d/jN3SnJqaFKcV+zO+GdHsakh0LTenFox3mH8xqhedZID+iWG5JvjvuNzmpyu2T2/3prhIwdxJ44V0Cvv2DbP/2JF5AA4fN3W8VHJrieofd3hvhShmwhNtrSARxEac7e93oiwFc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=3FirDqx1; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=IZwF0JnS; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="3FirDqx1"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="IZwF0JnS" Message-ID: <20251119172549.706439391@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1763573225; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=0VqhRW6oYbFoX+pUDpJng6sQ6MbQ0lCZ4YtA62Myk00=; b=3FirDqx1vRGkYpdWKSJzn459RaDIISbc1ptI74sJ36Y8iTfgrmxM69lUw/EMqOt1Lpr0fA o4YVsLUuXAO500wqKWRWYdCIJHFF0B4OkskLU9akKG+FCOb4CiarNE2sdZURlGZOZ4nF9K dnWtAl12A/BtjgHmeglqKm0Lwe3sfQkYbKH5409o+me6e6qHfMgn82RRlqJV3zcBFnMQ69 /Pk5b6TH08Aq/PifuUDtXnPywlJVgMj3wATgVnpJhuTgypc38dHaDGDBP0SeIKHf53LUxS Z8bokjuooZ4U2dN2dCAnYGaEqHZtMJmGhx+KCqxP+u6s25BBkBrJtcSQzGzAog== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1763573225; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=0VqhRW6oYbFoX+pUDpJng6sQ6MbQ0lCZ4YtA62Myk00=; b=IZwF0JnSjPCISLS/jgALFrm98eiwyFW5PMc+RnIUkozTcNFRtypQ8vgKjRqV8HpaGRCgVX bnKy5h/ks6nbngCg== From: Thomas Gleixner To: LKML Cc: Peter Zijlstra , Gabriele Monaco , Mathieu Desnoyers , Michael Jeanson , Jens Axboe , "Paul E. McKenney" , "Gautham R. Shenoy" , Florian Weimer , Tim Chen , Yury Norov , Shrikanth Hegde Subject: [patch V5 11/20] signal: Move MMCID exit out of sighand lock References: <20251119171016.815482037@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Date: Wed, 19 Nov 2025 18:27:05 +0100 (CET) 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 Reviewed-by: Mathieu Desnoyers --- include/linux/sched.h | 4 ++-- kernel/exit.c | 1 + kernel/sched/core.c | 4 ++-- kernel/signal.c | 2 -- 4 files changed, 5 insertions(+), 6 deletions(-) --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -2298,7 +2298,7 @@ static __always_inline void alloc_tag_re void sched_mm_cid_before_execve(struct task_struct *t); void sched_mm_cid_after_execve(struct task_struct *t); void sched_mm_cid_fork(struct task_struct *t); -void sched_mm_cid_exit_signals(struct task_struct *t); +void sched_mm_cid_exit(struct task_struct *t); static inline int task_mm_cid(struct task_struct *t) { return t->mm_cid.cid; @@ -2307,7 +2307,7 @@ static inline int task_mm_cid(struct tas static inline void sched_mm_cid_before_execve(struct task_struct *t) { } static inline void sched_mm_cid_after_execve(struct task_struct *t) { } static inline void sched_mm_cid_fork(struct task_struct *t) { } -static inline void sched_mm_cid_exit_signals(struct task_struct *t) { } +static inline void sched_mm_cid_exit(struct task_struct *t) { } static inline int task_mm_cid(struct task_struct *t) { /* --- a/kernel/exit.c +++ b/kernel/exit.c @@ -910,6 +910,7 @@ void __noreturn do_exit(long code) user_events_exit(tsk); io_uring_files_cancel(); + sched_mm_cid_exit(tsk); exit_signals(tsk); /* sets PF_EXITING */ seccomp_filter_release(tsk); --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -10392,7 +10392,7 @@ static inline void mm_update_cpus_allowe WRITE_ONCE(mm->mm_cid.nr_cpus_allowed, weight); } -void sched_mm_cid_exit_signals(struct task_struct *t) +void sched_mm_cid_exit(struct task_struct *t) { struct mm_struct *mm = t->mm; @@ -10410,7 +10410,7 @@ void sched_mm_cid_exit_signals(struct ta /* Deactivate MM CID allocation across execve() */ void sched_mm_cid_before_execve(struct task_struct *t) { - sched_mm_cid_exit_signals(t); + sched_mm_cid_exit(t); } /* Reactivate MM CID after successful execve() */ --- a/kernel/signal.c +++ b/kernel/signal.c @@ -3125,7 +3125,6 @@ void exit_signals(struct task_struct *ts cgroup_threadgroup_change_begin(tsk); if (thread_group_empty(tsk) || (tsk->signal->flags & SIGNAL_GROUP_EXIT)) { - sched_mm_cid_exit_signals(tsk); tsk->flags |= PF_EXITING; cgroup_threadgroup_change_end(tsk); return; @@ -3136,7 +3135,6 @@ void exit_signals(struct task_struct *ts * From now this task is not visible for group-wide signals, * see wants_signal(), do_signal_stop(). */ - sched_mm_cid_exit_signals(tsk); tsk->flags |= PF_EXITING; cgroup_threadgroup_change_end(tsk);