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

2017-03-13 Thread Eric Biggers
On Mon, Mar 13, 2017 at 11:27:32AM +0100, Florian Weimer wrote: > On 03/13/2017 05:34 AM, Andreas Dilger wrote: > >Not that it is a huge deal either way, but I'd think it is harder for the > >compiler to optimize across a function call boundary like memset() vs. a > >struct initialization in the

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

2017-03-13 Thread Eric Biggers
On Mon, Mar 13, 2017 at 11:27:32AM +0100, Florian Weimer wrote: > On 03/13/2017 05:34 AM, Andreas Dilger wrote: > >Not that it is a huge deal either way, but I'd think it is harder for the > >compiler to optimize across a function call boundary like memset() vs. a > >struct initialization in the

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

2017-03-13 Thread Florian Weimer
On 03/13/2017 05:34 AM, Andreas Dilger wrote: Not that it is a huge deal either way, but I'd think it is harder for the compiler to optimize across a function call boundary like memset() vs. a struct initialization in the same function where it can see that all but a few of the fields are being

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

2017-03-13 Thread Florian Weimer
On 03/13/2017 05:34 AM, Andreas Dilger wrote: Not that it is a huge deal either way, but I'd think it is harder for the compiler to optimize across a function call boundary like memset() vs. a struct initialization in the same function where it can see that all but a few of the fields are being

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

2017-03-12 Thread Andreas Dilger
On Mar 11, 2017, at 11:01 PM, Eric Biggers wrote: > > On Sat, Mar 11, 2017 at 08:02:06PM -0800, Eric Biggers wrote: >> On Sun, Mar 12, 2017 at 02:29:27AM +, Al Viro wrote: >>> >>> Oh, I agree that multiple __put_user() are wrong; I also agree that bulk >>> copy is the

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

2017-03-12 Thread Andreas Dilger
On Mar 11, 2017, at 11:01 PM, Eric Biggers wrote: > > On Sat, Mar 11, 2017 at 08:02:06PM -0800, Eric Biggers wrote: >> On Sun, Mar 12, 2017 at 02:29:27AM +, Al Viro wrote: >>> >>> Oh, I agree that multiple __put_user() are wrong; I also agree that bulk >>> copy is the right approach (when

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

2017-03-11 Thread Eric Biggers
On Sat, Mar 11, 2017 at 08:02:06PM -0800, Eric Biggers wrote: > On Sun, Mar 12, 2017 at 02:29:27AM +, 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 > >

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

2017-03-11 Thread Eric Biggers
On Sat, Mar 11, 2017 at 08:02:06PM -0800, Eric Biggers wrote: > On Sun, Mar 12, 2017 at 02:29:27AM +, 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 > >

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

2017-03-11 Thread Eric Biggers
On Sun, Mar 12, 2017 at 02:29:27AM +, 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

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

2017-03-11 Thread Eric Biggers
On Sun, Mar 12, 2017 at 02:29:27AM +, 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

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

2017-03-11 Thread Al Viro
On Sat, Mar 11, 2017 at 06:16:55PM -0800, Eric Biggers wrote: > Hi Al, > > On Sun, Mar 12, 2017 at 01:24:15AM +, Al Viro wrote: > > On Sat, Mar 11, 2017 at 01:45:55PM -0800, Eric Biggers wrote: > > > From: Eric Biggers > > > > > > I found that statx() was significantly

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

2017-03-11 Thread Al Viro
On Sat, Mar 11, 2017 at 06:16:55PM -0800, Eric Biggers wrote: > Hi Al, > > On Sun, Mar 12, 2017 at 01:24:15AM +, Al Viro wrote: > > On Sat, Mar 11, 2017 at 01:45:55PM -0800, Eric Biggers wrote: > > > From: Eric Biggers > > > > > > I found that statx() was significantly slower than stat().

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

2017-03-11 Thread Eric Biggers
Hi Al, On Sun, Mar 12, 2017 at 01:24:15AM +, Al Viro wrote: > On Sat, Mar 11, 2017 at 01:45:55PM -0800, Eric Biggers wrote: > > From: Eric Biggers > > > > I found that statx() was significantly slower than stat(). As a > > microbenchmark, I compared 10,000,000

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

2017-03-11 Thread Eric Biggers
Hi Al, On Sun, Mar 12, 2017 at 01:24:15AM +, Al Viro wrote: > On Sat, Mar 11, 2017 at 01:45:55PM -0800, Eric Biggers wrote: > > From: Eric Biggers > > > > I found that statx() was significantly slower than stat(). As a > > microbenchmark, I compared 10,000,000 invocations of fstat() on a

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

2017-03-11 Thread Al Viro
On Sat, Mar 11, 2017 at 01:45:55PM -0800, Eric Biggers wrote: > From: Eric Biggers > > I found that statx() was significantly slower than stat(). As a > microbenchmark, I compared 10,000,000 invocations of fstat() on a tmpfs > file to the same with statx() passed a NULL

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

2017-03-11 Thread Al Viro
On Sat, Mar 11, 2017 at 01:45:55PM -0800, Eric Biggers wrote: > From: Eric Biggers > > I found that statx() was significantly slower than stat(). As a > microbenchmark, I compared 10,000,000 invocations of fstat() on a tmpfs > file to the same with statx() passed a NULL path: Umm... > +

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

2017-03-11 Thread Eric Biggers
From: Eric Biggers I found that statx() was significantly slower than stat(). As a microbenchmark, I compared 10,000,000 invocations of fstat() on a tmpfs file to the same with statx() passed a NULL path: $ time ./stat_benchmark real0m1.464s

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

2017-03-11 Thread Eric Biggers
From: Eric Biggers I found that statx() was significantly slower than stat(). As a microbenchmark, I compared 10,000,000 invocations of fstat() on a tmpfs file to the same with statx() passed a NULL path: $ time ./stat_benchmark real0m1.464s user0m0.275s