public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Mateusz Guzik <mjguzik@gmail.com>
To: Rich Felker <dalias@libc.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	 Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>,
	Andreas Schwab <schwab@suse.de>,
	 Mateusz Guzik via Libc-alpha <libc-alpha@sourceware.org>
Subject: Re: fstat(2) penalized by using newfstatat(6, "", buf, AT_EMPTY_PATH)
Date: Tue, 5 Sep 2023 23:46:21 +0200	[thread overview]
Message-ID: <CAGudoHGOjr7ZRi8R_gzi7kbihooGADX1E0xugJAP7nUOoUOGQA@mail.gmail.com> (raw)
In-Reply-To: <20230905214242.GJ20403@brightrain.aerifal.cx>

On 9/5/23, Rich Felker <dalias@libc.org> wrote:
> On Tue, Sep 05, 2023 at 10:45:17AM -0700, Linus Torvalds wrote:
>> On Tue, 5 Sept 2023 at 10:28, Adhemerval Zanella Netto
>> <adhemerval.zanella@linaro.org> wrote:
>> >
>> > I think we can still make it in a generic way, stat family would use
>> > more
>> > syscall (which some filters might complain) but it should be ok:
>>
>> Ugh. That patch of yours certainly seems to avoid the kernel overhead
>> (where that "fetch a byte from user space just to check it is '\0'" is
>> much more expensive than it is in user space), but why does glibc do
>> that whole "turn fstat() into fstatat(), and then turn it back again"?
>>
>> It seems just stupid. If the user asked for 'fstat()', just give the
>> user 'fstat()'.
>
> We do it in musl, but we also do the "turn it back again" in
> userspace. musl's __fstatat_kstat checks if AT_EMPTY_PATH is set, and
> if so, calls SYS_fstat. I don't see why glibc couldn't do the same.
>
> However, we don't do this, and this does not seem to be possible, in
> the case where statx has to be used (32-bit archs). Is there an
> analogous issue for statx?
>

Yes and *currently* statx does not have a way out, but I'm going to
propose some patches to Linux about it in foreseeable future.

-- 
Mateusz Guzik <mjguzik gmail.com>

  reply	other threads:[~2023-09-05 21:46 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-04  9:55 Mateusz Guzik
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 [this message]
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=CAGudoHGOjr7ZRi8R_gzi7kbihooGADX1E0xugJAP7nUOoUOGQA@mail.gmail.com \
    --to=mjguzik@gmail.com \
    --cc=adhemerval.zanella@linaro.org \
    --cc=dalias@libc.org \
    --cc=libc-alpha@sourceware.org \
    --cc=schwab@suse.de \
    --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).