linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Pedro Falcato <pedro.falcato@gmail.com>,
	Christian Brauner <christian@brauner.io>,
	Shuah Khan <shuah@kernel.org>,
	"Liam R . Howlett" <Liam.Howlett@oracle.com>,
	Suren Baghdasaryan <surenb@google.com>,
	Vlastimil Babka <vbabka@suse.cz>,
	linux-kselftest@vger.kernel.org, linux-mm@kvack.org,
	linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org,
	linux-kernel@vger.kernel.org, Oliver Sang <oliver.sang@intel.com>,
	John Hubbard <jhubbard@nvidia.com>, Tejun Heo <tj@kernel.org>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Michal Koutny <mkoutny@suse.com>,
	Shakeel Butt <shakeel.butt@linux.dev>
Subject: Re: [PATCH v7 0/6] introduce PIDFD_SELF* sentinels
Date: Fri, 31 Jan 2025 10:21:31 +0000	[thread overview]
Message-ID: <7519b85a-cd04-4ae9-a8c8-3d16fb20582e@lucifer.local> (raw)
In-Reply-To: <20250130153236.198664b9a19ccfcdb24f888b@linux-foundation.org>

On Thu, Jan 30, 2025 at 03:32:36PM -0800, Andrew Morton wrote:
> On Thu, 30 Jan 2025 23:10:53 +0000 Pedro Falcato <pedro.falcato@gmail.com> wrote:
>
> > On Thu, Jan 30, 2025 at 10:53 PM Lorenzo Stoakes
> > <lorenzo.stoakes@oracle.com> wrote:
> > >
> > > > The above code sequence doesn't seem at all onerous.  I'm not
> > > > understanding why it's worth altering the kernel to permit this little
> > > > shortcut?
> > >
> > > In practice it adds quite a bit of overhead for something that whatever
> > > mechanism is using the pidfd can avoid.
> > >
> > > It was specifically intended for a real case of utilising
> > > process_madvise(), using the newly extended ability to batch _any_
> > > madvise() operations for the current process, like:
> > >
> > >         if (process_madvise(PIDFD_SELF, iovec, 10, MADV_GUARD_INSTALL, 0)) {
> > >             ... error handling ...
> > >         }
> > >
> > > vs.
> > >
> > >         pid_t pid = getpid();
> > >         int pidfd = pidfd_open(pid, PIDFD_THREAD);
> > >
> > >         if (pidfd < 0) {
> > >            ... error handling ...
> > >         }
> > >
> > >         if (process_madvise(PIDFD_SELF, iovec, 10, MADV_GUARD_INSTALL, 0)) {
> > >            ... cleanup pidfd ...
> > >            ... error handling ...
> > >         }
> > >
> > >         ...
> > >
> > >         ... cleanup pidfd ...
> > >
> > > So in practice, it's actually a lot more ceremony and noise. Suren has been
> > > working with this code in practice and found this to be useful.
> >
> > It's also nice to add that people on the libc/allocator side should
> > also appreciate skipping pidfd_open's reliability concerns (mostly,
> > that RLIMIT_NOFILE Should Not(tm) ever affect thread spawning or a
> > malloc[1]). Besides the big syscall reduction and nice speedup, that
> > is.
> >
> > [1] whether this is the already case is an exercise left to the
> > reader, but at the very least we should not add onto existing problems
>
> Thanks.
>
> Could we please get all the above spelled out much more thoroughly in
> the [0/n] description (aka Patch Series Sales Brochure)?

Ack, will expand if there's a respin, or Christian - perhaps you could fold
the above explanation into the cover letter?

Intent is for Christian to take this in his tree (if he so wishes) to be
clear!

Cheers

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

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-30 20:40 [PATCH v7 0/6] introduce PIDFD_SELF* sentinels Lorenzo Stoakes
2025-01-30 20:40 ` [PATCH v7 1/6] pidfd: add PIDFD_SELF* sentinels to refer to own thread/process Lorenzo Stoakes
2025-02-04 16:51   ` Shakeel Butt
2025-02-11 15:24   ` Michal Koutný
2025-02-11 15:45     ` Lorenzo Stoakes
2025-02-17  8:24       ` Christian Brauner
2025-01-30 20:40 ` [PATCH v7 2/6] selftests/pidfd: add missing system header imcludes to pidfd tests Lorenzo Stoakes
2025-02-05  5:13   ` Shakeel Butt
2025-02-05 12:06   ` Peter Seiderer
2025-01-30 20:40 ` [PATCH v7 3/6] tools: testing: separate out wait_for_pid() into helper header Lorenzo Stoakes
2025-02-05  5:15   ` Shakeel Butt
2025-01-30 20:40 ` [PATCH v7 4/6] selftests: pidfd: add pidfd.h UAPI wrapper Lorenzo Stoakes
2025-01-30 20:40 ` [PATCH v7 5/6] selftests: pidfd: add tests for PIDFD_SELF_* Lorenzo Stoakes
2025-02-05  5:27   ` Shakeel Butt
2025-01-30 20:40 ` [PATCH v7 6/6] selftests/mm: use PIDFD_SELF in guard pages test Lorenzo Stoakes
2025-02-05  5:28   ` Shakeel Butt
2025-01-30 22:37 ` [PATCH v7 0/6] introduce PIDFD_SELF* sentinels Andrew Morton
2025-01-30 22:53   ` Lorenzo Stoakes
2025-01-30 23:10     ` Pedro Falcato
2025-01-30 23:32       ` Andrew Morton
2025-01-31 10:21         ` Lorenzo Stoakes [this message]
2025-02-01 11:12           ` Christian Brauner
2025-02-01 16:38             ` Lorenzo Stoakes
2025-02-04  9:46 ` Christian Brauner
2025-02-04 10:01   ` Lorenzo Stoakes
2025-02-04 17:43     ` Suren Baghdasaryan
2025-02-05  9:29       ` Christian Brauner

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=7519b85a-cd04-4ae9-a8c8-3d16fb20582e@lucifer.local \
    --to=lorenzo.stoakes@oracle.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=christian@brauner.io \
    --cc=hannes@cmpxchg.org \
    --cc=jhubbard@nvidia.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mkoutny@suse.com \
    --cc=oliver.sang@intel.com \
    --cc=pedro.falcato@gmail.com \
    --cc=shakeel.butt@linux.dev \
    --cc=shuah@kernel.org \
    --cc=surenb@google.com \
    --cc=tj@kernel.org \
    --cc=vbabka@suse.cz \
    /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;
as well as URLs for NNTP newsgroup(s).