[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGudoHEg3k96oNSK-kOe+3StBv3z86iMVQjPd1pn1=SjtPQUVA@mail.gmail.com>
Date: Wed, 19 Mar 2025 20:18:12 +0100
From: Mateusz Guzik <mjguzik@...il.com>
To: Oleg Nesterov <oleg@...hat.com>
Cc: akpm@...ux-foundation.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] exit: combine work under lock in synchronize_group_exit()
and coredump_task_exit()
On Wed, Mar 19, 2025 at 8:10 PM Oleg Nesterov <oleg@...hat.com> wrote:
>
> On 03/19, Mateusz Guzik wrote:
> >
> > + spin_lock_irq(&sighand->siglock);
> > + synchronize_group_exit(tsk, code);
> > + core_state = coredump_task_exit_prep(tsk);
> > + spin_unlock_irq(&sighand->siglock);
>
> Well, but why do we need the new (and trivial) coredump_task_exit_prep?
>
it's not *needed*, i claim it is cleaner
but i'm not going to argue about this, i'll submit and updated patch
later this evening or tomorrow
> Can't synchronize_group_exit() be
>
> static struct core_state *synchronize_group_exit(struct task_struct *tsk, long code)
> {
> struct sighand_struct *sighand = tsk->sighand;
> struct signal_struct *signal = tsk->signal;
> struct core_state *core_state = NULL;
>
> spin_lock_irq(&sighand->siglock);
> signal->quick_threads--;
> if ((signal->quick_threads == 0) &&
> !(signal->flags & SIGNAL_GROUP_EXIT)) {
> signal->flags = SIGNAL_GROUP_EXIT;
> signal->group_exit_code = code;
> signal->group_stop_count = 0;
> }
> /*
> * Serialize with any possible pending coredump.
> * We must hold siglock around checking core_state
> * and setting PF_POSTCOREDUMP. The core-inducing thread
> * will increment ->nr_threads for each thread in the
> * group without PF_POSTCOREDUMP set.
> */
> tsk->flags |= PF_POSTCOREDUMP;
> core_state = tsk->signal->core_state;
> spin_unlock_irq(&sighand->siglock);
>
> return core_state;
> }
>
> ?
>
> No need to shift spin_lock_irq(siglock) from synchronize_group_exit() to do_exit(),
> no need to rename coredump_task_exit...
>
> Oleg.
>
--
Mateusz Guzik <mjguzik gmail.com>
Powered by blists - more mailing lists