[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CACT4Y+YBO_1oYccnQdZrS_o1G2bSSPBmYBdjsMXN_8d2zncbQA@mail.gmail.com>
Date: Mon, 25 Nov 2024 12:19:19 +0100
From: Dmitry Vyukov <dvyukov@...gle.com>
To: Oleg Nesterov <oleg@...hat.com>
Cc: Frederic Weisbecker <frederic@...nel.org>, Thomas Gleixner <tglx@...utronix.de>,
LKML <linux-kernel@...r.kernel.org>,
Anna-Maria Behnsen <anna-maria@...utronix.de>, Anthony Mallet <anthony.mallet@...s.fr>
Subject: Re: [PATCH] posix-timers: Target group sigqueue to current task only
if not exiting
On Mon, 25 Nov 2024 at 12:13, Oleg Nesterov <oleg@...hat.com> wrote:
>
> On 11/25, Dmitry Vyukov wrote:
> >
> > On Sat, 23 Nov 2024 at 11:13, Oleg Nesterov <oleg@...hat.com> wrote:
> > >
> > > On 11/23, Frederic Weisbecker wrote:
> > > >
> > > > - * the same thread group as the target process, which avoids
> > > > - * unnecessarily waking up a potentially idle task.
> > > > + * the same thread group as the target process and its sighand is
> > > > + * stable, which avoids unnecessarily waking up a potentially idle task.
> > > > */
> > > > static inline struct task_struct *posixtimer_get_target(struct k_itimer *tmr)
> > > > {
> > > > struct task_struct *t = pid_task(tmr->it_pid, tmr->it_pid_type);
> > > >
> > > > - if (t && tmr->it_pid_type != PIDTYPE_PID && same_thread_group(t, current))
> > > > + if (t && tmr->it_pid_type != PIDTYPE_PID &&
> > > > + same_thread_group(t, current) && !current->exit_state)
> > > > t = current;
> > >
> > > Thanks!
> > >
> > > Acked-by: Oleg Nesterov <oleg@...hat.com>
> >
> > Can't the group leader be exiting as well?
>
> It can. It is even possible that the group leader is already a zombie.
>
> But this is fine. release_task(zombie-or-exiting-leader) (which does __exit_signal()
> and clears ->sighand) won't be called until all the sub-threads have exited.
>
> And. If all the sub-threads (and the group leader) have exited, then send_sigqueue()
> makes no sense, the whole process is dead. so we do not care if lock_task_sighand()
> fails in this case.
Ah, I see. Thanks.
> > Though, that's still an
> > improvements. People usually don't do that (exiting from main w/o
> > killing the process).
>
> See above. Nothing to improve, AFAICS.
>
> > So thanks for the fix.
>
> Yes, thank you Anthony and Frederic!
>
> Oleg.
>
Powered by blists - more mailing lists