Re: [PATCH 02/11] mm: call import_iovec() instead of rw_copy_check_uvector() in process_vm_rw()

2020-09-21 Thread Al Viro
On Mon, Sep 21, 2020 at 03:44:00PM +, David Laight wrote: > From: Al Viro > > Sent: 21 September 2020 16:30 > > > > On Mon, Sep 21, 2020 at 03:21:35PM +, David Laight wrote: > > > > > You really don't want to be looping through the array twice. > > > > Profiles, please. > > I did some p

Re: [PATCH 02/11] mm: call import_iovec() instead of rw_copy_check_uvector() in process_vm_rw()

2020-09-21 Thread Christoph Hellwig
On Mon, Sep 21, 2020 at 04:29:37PM +0100, Al Viro wrote: > On Mon, Sep 21, 2020 at 03:21:35PM +, David Laight wrote: > > > You really don't want to be looping through the array twice. > > Profiles, please. Given that the iov array should be cache hot I'd be surprised to see a huge difference

RE: [PATCH 02/11] mm: call import_iovec() instead of rw_copy_check_uvector() in process_vm_rw()

2020-09-21 Thread David Laight
From: Al Viro > Sent: 21 September 2020 16:30 > > On Mon, Sep 21, 2020 at 03:21:35PM +, David Laight wrote: > > > You really don't want to be looping through the array twice. > > Profiles, please. I did some profiling of send() v sendmsg() much earlier in the year. I can't remember the exac

Re: [PATCH 02/11] mm: call import_iovec() instead of rw_copy_check_uvector() in process_vm_rw()

2020-09-21 Thread Al Viro
On Mon, Sep 21, 2020 at 03:21:35PM +, David Laight wrote: > You really don't want to be looping through the array twice. Profiles, please. > I think the 'length' check can be optimised to do something like: > for (...) { > ssize_t len = (ssize_t)iov[seg].iov_len; >

RE: [PATCH 02/11] mm: call import_iovec() instead of rw_copy_check_uvector() in process_vm_rw()

2020-09-21 Thread David Laight
From: Al Viro > Sent: 21 September 2020 16:02 > > On Mon, Sep 21, 2020 at 04:34:25PM +0200, Christoph Hellwig wrote: > > From: David Laight > > > > This is the only direct call of rw_copy_check_uvector(). Removing it > > will allow rw_copy_check_uvector() to be inlined into import_iovec(), > > w

Re: [PATCH 02/11] mm: call import_iovec() instead of rw_copy_check_uvector() in process_vm_rw()

2020-09-21 Thread Al Viro
On Mon, Sep 21, 2020 at 04:34:25PM +0200, Christoph Hellwig wrote: > From: David Laight > > This is the only direct call of rw_copy_check_uvector(). Removing it > will allow rw_copy_check_uvector() to be inlined into import_iovec(), > while only paying a minor price by setting up an otherwise un

Re: [PATCH 02/11] mm: call import_iovec() instead of rw_copy_check_uvector() in process_vm_rw()

2020-09-21 Thread Matthew Wilcox
On Mon, Sep 21, 2020 at 04:34:25PM +0200, Christoph Hellwig wrote: > { > - WARN_ON(direction & ~(READ | WRITE)); > + WARN_ON(direction & ~(READ | WRITE | CHECK_IOVEC_ONLY)); This is now a no-op because: include/linux/fs.h:#define CHECK_IOVEC_ONLY -1 I'd suggest we renumber it to 2? (RE

[PATCH 02/11] mm: call import_iovec() instead of rw_copy_check_uvector() in process_vm_rw()

2020-09-21 Thread Christoph Hellwig
From: David Laight This is the only direct call of rw_copy_check_uvector(). Removing it will allow rw_copy_check_uvector() to be inlined into import_iovec(), while only paying a minor price by setting up an otherwise unused iov_iter in the process_vm_readv/process_vm_writev syscalls that aren't