public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Mateusz Guzik <mjguzik@gmail.com>
To: libc-alpha@sourceware.org
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	 Adhemerval Zanella <adhemerval.zanella@linaro.org>
Subject: fstat(2) penalized by using newfstatat(6, "", buf, AT_EMPTY_PATH)
Date: Mon, 4 Sep 2023 11:55:37 +0200	[thread overview]
Message-ID: <CAGudoHG83bsjmsy9nvmqUGrSORRdnu0D8tQDRq=qm8+WWT00Eg@mail.gmail.com> (raw)

Commit 4d97cc8cf3da ("io: Remove xstat implementations") reimplemented
fstat entry point on top of newfstatat (as opposed to newfstat).

This comes with a significant performance penalty as it induces a lot
of work on kernel side to handle the path, which is additionally
slowed down on x86-64 due to SMAP handling.

Here are sample results from calling newfstatat vs newfstat on Sapphire Rapids:
newfstatat 5088199
newfstat   8540383 (+67%)

Are there any problems switching it back to newfstat at least for x86-64?

If you want to bench yourself you can grab will-it-scale +
https://github.com/antonblanchard/will-it-scale/pull/35/files + patch
up one of the testcases to call newfstat directly: int error =
syscall(5, fd, &sb);

Note if you bench yourself and have a CPU significantly impacted by
mitigations (e.g., meltdown) the difference may be very small in your
setup.

-- 
Mateusz Guzik <mjguzik gmail.com>

             reply	other threads:[~2023-09-04  9:55 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-04  9:55 Mateusz Guzik [this message]
2023-09-04 10:08 ` Andreas Schwab
2023-09-04 10:11   ` Mateusz Guzik
2023-09-05 13:01     ` Adhemerval Zanella Netto
2023-09-05 13:14       ` Mateusz Guzik
2023-09-05 17:28         ` Adhemerval Zanella Netto
2023-09-05 17:45           ` Linus Torvalds
2023-09-05 18:22             ` Adhemerval Zanella Netto
2023-09-05 19:16               ` Adhemerval Zanella Netto
2023-09-05 19:21                 ` Linus Torvalds
2023-09-05 21:42             ` Rich Felker
2023-09-05 21:46               ` Mateusz Guzik
2023-09-05 17:29         ` Linus Torvalds

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='CAGudoHG83bsjmsy9nvmqUGrSORRdnu0D8tQDRq=qm8+WWT00Eg@mail.gmail.com' \
    --to=mjguzik@gmail.com \
    --cc=adhemerval.zanella@linaro.org \
    --cc=libc-alpha@sourceware.org \
    --cc=torvalds@linux-foundation.org \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).