linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Mateusz Guzik <mjguzik@gmail.com>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: brauner@kernel.org, oleg@redhat.com, akpm@linux-foundation.org,
	 linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] exit: perform randomness and pid work without tasklist_lock
Date: Fri, 31 Jan 2025 23:31:01 +0100	[thread overview]
Message-ID: <CAGudoHHd3cE6+nyZY3wi5Xw5++uKiypR3qK_3=2XcGNocE4Vyw@mail.gmail.com> (raw)
In-Reply-To: <87ikpubt4c.fsf@email.froward.int.ebiederm.org>

On Fri, Jan 31, 2025 at 9:56 PM Eric W. Biederman <ebiederm@xmission.com> wrote:
> Moving proc_flush_pid inside of tasklist_lock is a bad idea.

The patch does not make such a change though.

The call is still performed without the lock, but it also dodges the
additional refcount dance (and notably eliminates an atomic from an
area protected by tasklist_lock).

>
> It is wrong that attach_pid/detach_pid can be performed without the
> tasklist_lock.  There are reasonable guarantees provided by the posix
> standard that the set of processes sent a signal is the set of
> processes at a point in time.  The tasklist_lock is how we provide
> those guarantees currently.
>

I don't see anything calling these without the lock and neither my
patch nor a follow up about pids suggest anything of the sort.

> There are two more layers to pids.  The pid number allocation of
> alloc_pid/free_pid, and the struct pid layer maintained by get_pid,
> put_pid.  Those two layers don't need the tasklist_lock.
>
>
> It is safe to move free_pid out of tasklist_lock.  I am not certain
> how sane it is.
>

Where is the sanity problem here? AFAICS this just delays some wakeups
in the worst case.

Regardless, looks like I have enough to send a v2 for further commentary.

-- 
Mateusz Guzik <mjguzik gmail.com>


  reply	other threads:[~2025-01-31 22:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-28 16:07 Mateusz Guzik
2025-01-28 18:29 ` Oleg Nesterov
2025-01-28 18:38   ` Mateusz Guzik
2025-01-28 19:22     ` Oleg Nesterov
2025-01-30 11:01       ` Mateusz Guzik
2025-01-31 20:55 ` Eric W. Biederman
2025-01-31 22:31   ` Mateusz Guzik [this message]
2025-01-31 23:09     ` Eric W. Biederman
2025-02-01 14:03       ` Mateusz Guzik

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='CAGudoHHd3cE6+nyZY3wi5Xw5++uKiypR3qK_3=2XcGNocE4Vyw@mail.gmail.com' \
    --to=mjguzik@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=brauner@kernel.org \
    --cc=ebiederm@xmission.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=oleg@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox