Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1598539

Re: [PATCH v2] statx: optimize copy of struct statx to userspace

From Eric Biggers <ebiggers3@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2] statx: optimize copy of struct statx to userspace
Date 2017-03-12 05:10 +0100
Message-ID <tk2Zr-4xK-3@gated-at.bofh.it> (permalink)
References <tjX3H-fX-9@gated-at.bofh.it> <tk0uB-2J5-3@gated-at.bofh.it> <tk1h0-3eX-5@gated-at.bofh.it> <tk1Al-3lE-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Sun, Mar 12, 2017 at 02:29:27AM +0000, Al Viro wrote:
> 
> Oh, I agree that multiple __put_user() are wrong; I also agree that bulk copy is
> the right approach (when we get the unsafe stuff right, we can revisit that, but
> I suspect that on quite a few architectures a bulk copy will still give better
> time, no matter what).
> 
> > If padding is a concern at all (AFAICS it's not actually an issue now with
> > struct statx, but people tend to have different opinions on how careful they
> > want to be with padding), then I think we'll just have to start by memsetting
> > the whole struct to 0.
> 
> My point is simply that it's worth a comment in that code.

Okay, thanks.  I'll add a comment about the padding assumption, and I think I'll
take the suggestion to use a designated initializer.  Then at least all *fields*
get initialized by default.  And if in the future someone wants to conditionally
initialize fields, then they can use ?: or they can do it after the initializer.
Either way, at least they won't be able to forget to zero some field.

- Eric

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2] statx: optimize copy of struct statx to userspace Eric Biggers <ebiggers3@gmail.com> - 2017-03-11 22:50 +0100
  Re: [PATCH v2] statx: optimize copy of struct statx to userspace Al Viro <viro@ZenIV.linux.org.uk> - 2017-03-12 02:30 +0100
    Re: [PATCH v2] statx: optimize copy of struct statx to userspace Eric Biggers <ebiggers3@gmail.com> - 2017-03-12 03:20 +0100
      Re: [PATCH v2] statx: optimize copy of struct statx to userspace Al Viro <viro@ZenIV.linux.org.uk> - 2017-03-12 03:40 +0100
        Re: [PATCH v2] statx: optimize copy of struct statx to userspace Eric Biggers <ebiggers3@gmail.com> - 2017-03-12 05:10 +0100
          Re: [PATCH v2] statx: optimize copy of struct statx to userspace Eric Biggers <ebiggers3@gmail.com> - 2017-03-12 07:10 +0100
            Re: [PATCH v2] statx: optimize copy of struct statx to userspace Andreas Dilger <adilger@dilger.ca> - 2017-03-13 05:40 +0100
              Re: [PATCH v2] statx: optimize copy of struct statx to userspace Florian Weimer <fweimer@redhat.com> - 2017-03-13 11:30 +0100
                Re: [PATCH v2] statx: optimize copy of struct statx to userspace Eric Biggers <ebiggers3@gmail.com> - 2017-03-13 19:20 +0100

csiph-web