From: Eric Biggers <ebiggers3@gmail.com>
To: David Howells <dhowells@redhat.com>
Cc: linux-fsdevel@vger.kernel.org, Al Viro <viro@zeniv.linux.org.uk>,
linux-kernel@vger.kernel.org, Eric Biggers <ebiggers@google.com>
Subject: Re: [PATCH v4] statx: optimize copy of struct statx to userspace
Date: Fri, 24 Mar 2017 14:08:26 -0700 [thread overview]
Message-ID: <20170324210826.GB4986@gmail.com> (raw)
In-Reply-To: <3434.1489664501@warthog.procyon.org.uk>
On Thu, Mar 16, 2017 at 11:41:41AM +0000, David Howells wrote:
> Eric Biggers <ebiggers3@gmail.com> wrote:
>
> > stat() instead initializes its struct on the stack and copies it to
> > userspace with a single call to copy_to_user(). This turns out to be
> > much faster, and changing statx to do this makes it almost as fast as
> > stat:
>
> I wonder if we actually need to copy __spare2 at the end. We could define any
> future values added in there to be unset/undefined if the respective bits are
> not set.
>
> I would prefer it to be cleaner, however, and clear the unused space.
>
> Another thought is does it make sense to rearrange struct kstat to mirror
> the first part of struct statx so that this can be memcpy'd?
>
> David
Not clearing __spare2 would effectively turn every new bit into specifying an
"extension of the buffer", and there would be no way for the kernel to provide a
"fabricated" value for any new field. I don't think it's the right choice.
Also I don't think it makes sense to rearrange struct kstat to match struct
statx, because that would bring details of the syscall ABI down into places it
shouldn't be. Also, struct kstat is used to hold information for both stat()
and statx(). It doesn't make sense to optimize statx() at the expense of stat()
yet because almost everything will still be using stat() in the near-term.
- Eric
prev parent reply other threads:[~2017-03-24 21:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-13 22:28 [PATCH v4] statx: optimize copy of struct statx to userspace Eric Biggers
2017-03-16 11:41 ` David Howells
2017-03-24 21:08 ` Eric Biggers [this message]
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=20170324210826.GB4986@gmail.com \
--to=ebiggers3@gmail.com \
--cc=dhowells@redhat.com \
--cc=ebiggers@google.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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