All of lore.kernel.org
 help / color / mirror / Atom feed
From: Frederic Weisbecker <frederic@kernel.org>
To: Oleg Nesterov <oleg@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Peter Zijlstra <peterz@infradead.org>,
	Wongi Lee <qw3rtyp0@gmail.com>, Jungwoo Lee <jwlee2217@gmail.com>,
	Anna-Maria Behnsen <anna-maria@linutronix.de>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] posix-cpu-timers: don't abuse lock_task_sighand() in handle_posix_cpu_timers()
Date: Wed, 8 Jul 2026 22:35:40 +0200	[thread overview]
Message-ID: <ak60nLrkUaaVxVAt@pavilion.home> (raw)
In-Reply-To: <akjp8AGpY8eJG5I1@redhat.com>

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 <oleg@redhat.com>

Reviewed-by: Frederic Weisbecker <frederic@kernel.org>

> ---
>  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

      parent reply	other threads:[~2026-07-08 20:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-04 11:09 [PATCH] posix-cpu-timers: don't abuse lock_task_sighand() in handle_posix_cpu_timers() Oleg Nesterov
2026-07-04 14:42 ` Bradley Morgan
2026-07-04 16:42   ` Oleg Nesterov
2026-07-04 17:05   ` Oleg Nesterov
2026-07-04 17:06     ` Bradley Morgan
2026-07-04 17:09     ` Oleg Nesterov
2026-07-05 12:27     ` Bradley Morgan
2026-07-05 10:18 ` [tip: timers/core] posix-cpu-timers: Don't " tip-bot2 for Oleg Nesterov
2026-07-08 20:35 ` Frederic Weisbecker [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ak60nLrkUaaVxVAt@pavilion.home \
    --to=frederic@kernel.org \
    --cc=anna-maria@linutronix.de \
    --cc=jwlee2217@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=qw3rtyp0@gmail.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.