From: Josh Triplett <josh@joshtriplett.org>
To: Kees Cook <keescook@chromium.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
Eric Biederman <ebiederm@xmission.com>,
Alexander Viro <viro@zeniv.linux.org.uk>,
linux-mm@kvack.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fs/exec.c: Add fast path for ENOENT on PATH search before allocating mm
Date: Sat, 1 Oct 2022 17:01:57 +0100 [thread overview]
Message-ID: <YzhkdZrb7vpodK6I@localhost> (raw)
In-Reply-To: <202209191256.893576D4@keescook>
On Mon, Sep 19, 2022 at 01:02:51PM -0700, Kees Cook wrote:
> On Sat, Sep 17, 2022 at 01:50:24AM +0100, Josh Triplett wrote:
> > On Fri, Sep 16, 2022 at 05:11:18PM -0700, Kees Cook wrote:
> > > I don't like the idea of penalizing the _succeeding_ case, though, which
> > > happens if we do the path walk twice. So, I went and refactoring the setup
> > > order, moving the do_open_execat() up into alloc_bprm() instead of where
> > > it was in bprm_exec(). The result makes it so it is, as you observed,
> > > before the mm creation and generally expensive argument copying. The
> > > difference to your patch seems to only be the allocation of the file
> > > table entry, but avoids the double lookup, so I'm hoping the result is
> > > actually even faster.
> >
> > Thanks for giving this a try; I'd wondered how feasible it would be to
> > just do one lookup.
> >
> > However, on the same test system with the same test setup, with your
> > refactor it seems to go slower:
> > fork/execvpe: 38087ns
> > fork/execve: 33758ns
> >
> > For comparison, the previous numbers (which I re-confirmed):
> >
> > Without fast-path:
> > fork/execvpe: 49876ns
> > fork/execve: 32773ns
> >
> > With my original separate-lookup fast-path:
> > fork/execvpe: 36890ns
> > fork/execve: 31551ns
>
> Hmm, this shows as slower in the *normal* case, which I find rather
> surprising -- it's the same work, just reordered.
>
> Can you post a URL to your tests? I'd like to reproduce this and maybe
> throw perf at it as well.
Sure. Sorry for the delay, needed to integrate some fixes (such as
aarch64 support) and factor out the bits that won't build if you don't
have a patched liburing.
https://github.com/joshtriplett/spawnbench
- Josh Triplett
next prev parent reply other threads:[~2022-10-01 16:02 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-16 13:41 Josh Triplett
2022-09-16 14:38 ` Kees Cook
2022-09-16 20:13 ` Josh Triplett
2022-09-17 0:11 ` Kees Cook
2022-09-17 0:50 ` Josh Triplett
2022-09-19 20:02 ` Kees Cook
2022-10-01 16:01 ` Josh Triplett [this message]
2022-09-19 14:34 ` Peter Zijlstra
2022-09-22 7:27 ` [fs/exec.c] 0a276ae2d2: BUG:workqueue_lockup-pool kernel test robot
2023-11-07 20:30 ` [PATCH] fs/exec.c: Add fast path for ENOENT on PATH search before allocating mm Kees Cook
2023-11-07 20:51 ` Mateusz Guzik
2023-11-07 21:23 ` Mateusz Guzik
2023-11-07 22:50 ` Kees Cook
2023-11-07 23:08 ` Mateusz Guzik
2023-11-07 23:39 ` Kees Cook
2023-11-08 0:03 ` Mateusz Guzik
2023-11-08 19:25 ` Kees Cook
2023-11-08 19:31 ` Kees Cook
2023-11-08 19:35 ` Mateusz Guzik
2023-11-09 0:17 ` Eric W. Biederman
2023-11-09 12:21 ` Mateusz Guzik
2023-11-10 5:26 ` Eric W. Biederman
2023-11-07 20:37 ` Kees Cook
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=YzhkdZrb7vpodK6I@localhost \
--to=josh@joshtriplett.org \
--cc=ebiederm@xmission.com \
--cc=keescook@chromium.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=peterz@infradead.org \
--cc=viro@zeniv.linux.org.uk \
/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