From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 29C1F2E7378 for ; Wed, 8 Jul 2026 20:35:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783542944; cv=none; b=Cxn2Eb9cFWraNS8R4Q/k1NeGa2WQMRiyoPAYgvz71vI1Vvpuv+lYNG1Rx2u4MePHTCOOoXrcr4snAgxKx/9m6xh3/0taB5FaDvUUX5reHj4tQa0Eho/PQoOlIH+Mmppv4rp/wnAQSorxxiK/1Rwi238y2vPTZ78QBwmxvqtDebQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783542944; c=relaxed/simple; bh=Fn04Il/A2IYiJgr9FhoNIaLnJHgPCwG1Hs5xk5yuLFk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ifcFe7PDdvncXrRARCrzc3jXk62zPIJjq7wcx2gJk2Zyu7SF98h2wsYY5Dg+XoNKPxa9lFSivzQWpBLX18haXum3JpUaB1KRXI3daf03xA+y4ooSUFquuvznmgeTR5JJrvgSuVVy8ApXnuuD77F5YZDxw9gyRvOG6igSe/37k8w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ULqoH75y; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ULqoH75y" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54A721F000E9; Wed, 8 Jul 2026 20:35:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1783542942; bh=me97VmWSKPafErH/sD7xgyqQdONN1fjd3cftEXsud40=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=ULqoH75y8RGTOmk47YYvvPxTS2yzhEzzTjvEjH0WvR+YfFo3d5grsVaL4zko523SB +qHl9K68SeLL6PnmNBR1p9NV1kqaMe1qOmVciD8PvB/MDRW1IAk0vI1VEe5mn2DHAQ juUmSdeJltGtFekL8SIYejxOdUdvcr5MAkE+IPB/CpKFM/pJrJx+a18cXkD3nfdJdR pW3yiTr3TaIwIKZMppAWh7QjQDXFRgL8Bh8aZvHwuKeaK8o9Z3sg+BtUJiEFxi06k9 EZ5cnQ631qBH8HfzHt/A0zUkvbG1BIitDYXPBf7YKZYfZ02hr3KpO/63KHl1Y8O5bO NMbB/4k861uaQ== Date: Wed, 8 Jul 2026 22:35:40 +0200 From: Frederic Weisbecker To: Oleg Nesterov Cc: Thomas Gleixner , Peter Zijlstra , Wongi Lee , Jungwoo Lee , Anna-Maria Behnsen , linux-kernel@vger.kernel.org Subject: Re: [PATCH] posix-cpu-timers: don't abuse lock_task_sighand() in handle_posix_cpu_timers() Message-ID: References: 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=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Le Sat, Jul 04, 2026 at 01:09:36PM +0200, Oleg Nesterov a écrit : > After the commit f90fff1e152d ("posix-cpu-timers: fix race between > handle_posix_cpu_timers() and posix_cpu_timer_del()"), tsk->sighand > is stable in handle_posix_cpu_timers(), so it can use the plain > spin_lock_irqsave(&tsk->sighand->siglock). > > Signed-off-by: Oleg Nesterov Reviewed-by: Frederic Weisbecker > --- > kernel/time/posix-cpu-timers.c | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > > diff --git a/kernel/time/posix-cpu-timers.c b/kernel/time/posix-cpu-timers.c > index a7d3e8229c4b..d73d31c7994f 100644 > --- a/kernel/time/posix-cpu-timers.c > +++ b/kernel/time/posix-cpu-timers.c > @@ -1357,8 +1357,11 @@ static void handle_posix_cpu_timers(struct task_struct *tsk) > unsigned long flags, start; > LIST_HEAD(firing); > > - if (!lock_task_sighand(tsk, &flags)) > - return; > + /* > + * tsk is current and ->sighand is stable, see the > + * tsk->exit_state check in run_posix_cpu_timers() > + */ > + spin_lock_irqsave(&tsk->sighand->siglock, flags); > > do { > /* > @@ -1418,7 +1421,7 @@ static void handle_posix_cpu_timers(struct task_struct *tsk) > * that gets the timer lock before we do will give it up and > * spin until we've taken care of that timer below. > */ > - unlock_task_sighand(tsk, &flags); > + spin_unlock_irqrestore(&tsk->sighand->siglock, flags); > > /* > * Now that all the timers on our list have the firing flag, > -- > 2.52.0 > > -- Frederic Weisbecker SUSE Labs