Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1602210 > unrolled thread
| Started by | David Howells <dhowells@redhat.com> |
|---|---|
| First post | 2017-03-16 12:50 +0100 |
| Last post | 2017-03-24 22:10 +0100 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH v4] statx: optimize copy of struct statx to userspace David Howells <dhowells@redhat.com> - 2017-03-16 12:50 +0100
Re: [PATCH v4] statx: optimize copy of struct statx to userspace Eric Biggers <ebiggers3@gmail.com> - 2017-03-24 22:10 +0100
| From | David Howells <dhowells@redhat.com> |
|---|---|
| Date | 2017-03-16 12:50 +0100 |
| Subject | Re: [PATCH v4] statx: optimize copy of struct statx to userspace |
| Message-ID | <tlC4O-684-9@gated-at.bofh.it> |
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
[toc] | [next] | [standalone]
| From | Eric Biggers <ebiggers3@gmail.com> |
|---|---|
| Date | 2017-03-24 22:10 +0100 |
| Message-ID | <toED7-7kH-7@gated-at.bofh.it> |
| In reply to | #1602210 |
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
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web