Re: [PATCH v3 3/6] exit: postpone tty_kref_put() until after tasklist_lock is dropped

From: Mateusz Guzik
Date: Mon Feb 03 2025 - 14:33:29 EST


On Mon, Feb 3, 2025 at 7:07 PM Oleg Nesterov <oleg@xxxxxxxxxx> wrote:
>
> On 02/01, Mateusz Guzik wrote:
> >
> > Instead of smuggling the tty pointer directly, use a struct so that more
> > things can be added later.
>
> I am not sure this particular change worth the effort, but I won't argue.
> I'd like to know what Eric thinks.
>

it trivially whacks an atomic from an area protected by a global lock

> OTOH, if we do this, then perhaps we can do more "call tty_kref_put()
> lockless" changes later. And perhaps even add the new
>
> void tty_kref_put_sync(struct tty_struct *tty)
> {
> if (tty)
> kref_put(&tty->kref, release_one_tty);
> }
>
> helper. With this change release_task() doesn't need to abuse
> schedule_work(), and this helper can have more users.
>
> Nevermind, this is almost off-topic.
>

I have no interest in messing with ttys, regardless I agree this is
definitely something to consider *after* this patch is sorted out.

--
Mateusz Guzik <mjguzik gmail.com>