RE: [RFC 1/3] lib: copy_{from,to}_user using gup & kmap_atomic()

2020-06-15 Thread David Laight
From: Al Viro > Sent: 13 June 2020 16:31 > On Sat, Jun 13, 2020 at 07:12:36PM +0530, afzal mohammed wrote: > > Hi, > > > > On Sat, Jun 13, 2020 at 01:56:15PM +0100, Al Viro wrote: > > > > > Incidentally, what about get_user()/put_user()? _That_ is where it's > > > going to really hurt... > > > > A

Re: [RFC 1/3] lib: copy_{from,to}_user using gup & kmap_atomic()

2020-06-14 Thread afzal mohammed
Hi, On Sun, Jun 14, 2020 at 06:51:43PM +0530, afzal mohammed wrote: > It is MB/s for copying one file to another via user space buffer, i.e. > the value coreutils 'dd' shows w/ status=progress (here it was busybox > 'dd', so instead it was enabling a compile time option) Just for correctness, st

Re: [RFC 1/3] lib: copy_{from,to}_user using gup & kmap_atomic()

2020-06-14 Thread afzal mohammed
Hi, On Sat, Jun 13, 2020 at 10:45:33PM +0200, Arnd Bergmann wrote: > 4% boot time increase sounds like a lot, especially if that is only for > copy_from_user/copy_to_user. In the end it really depends on how well > get_user()/put_user() and small copies can be optimized in the end. i mentioned t

Re: [RFC 1/3] lib: copy_{from,to}_user using gup & kmap_atomic()

2020-06-14 Thread afzal mohammed
Hi, On Sat, Jun 13, 2020 at 02:15:52PM +0100, Russell King - ARM Linux admin wrote: > On Sat, Jun 13, 2020 at 05:34:32PM +0530, afzal mohammed wrote: > > i think C > > library cuts any size read, write to page size (if it exceeds) & > > invokes the system call. > You can't make that assumption a

Re: [RFC 1/3] lib: copy_{from,to}_user using gup & kmap_atomic()

2020-06-13 Thread Matthew Wilcox
On Sat, Jun 13, 2020 at 10:45:33PM +0200, Arnd Bergmann wrote: > On Sat, Jun 13, 2020 at 2:04 PM afzal mohammed > wrote: > > Observation is that max. pages reaching copy_{from,to}_user() is 2, > > observed maximum of n (number of bytes) being 1 page size. i think C > > library cuts any size read,

Re: [RFC 1/3] lib: copy_{from,to}_user using gup & kmap_atomic()

2020-06-13 Thread Arnd Bergmann
On Sat, Jun 13, 2020 at 2:04 PM afzal mohammed wrote: > On Fri, Jun 12, 2020 at 10:07:28PM +0200, Arnd Bergmann wrote: > > > I think a lot > > of usercopy calls are only for a few bytes, though this is of course > > highly workload dependent and you might only care about the large > > ones. > > Ob

Re: [RFC 1/3] lib: copy_{from,to}_user using gup & kmap_atomic()

2020-06-13 Thread Arnd Bergmann
On Sat, Jun 13, 2020 at 6:00 PM Al Viro wrote: > On Sat, Jun 13, 2020 at 04:41:18PM +0100, Al Viro wrote: > > On Sat, Jun 13, 2020 at 04:31:02PM +0100, Al Viro wrote: > > > On Sat, Jun 13, 2020 at 07:12:36PM +0530, afzal mohammed wrote: > > > > Hi, > > > > > > > > On Sat, Jun 13, 2020 at 01:56:15P

Re: [RFC 1/3] lib: copy_{from,to}_user using gup & kmap_atomic()

2020-06-13 Thread Al Viro
On Sat, Jun 13, 2020 at 04:41:18PM +0100, Al Viro wrote: > On Sat, Jun 13, 2020 at 04:31:02PM +0100, Al Viro wrote: > > On Sat, Jun 13, 2020 at 07:12:36PM +0530, afzal mohammed wrote: > > > Hi, > > > > > > On Sat, Jun 13, 2020 at 01:56:15PM +0100, Al Viro wrote: > > > > > > > Incidentally, what a

Re: [RFC 1/3] lib: copy_{from,to}_user using gup & kmap_atomic()

2020-06-13 Thread Al Viro
On Sat, Jun 13, 2020 at 04:31:02PM +0100, Al Viro wrote: > On Sat, Jun 13, 2020 at 07:12:36PM +0530, afzal mohammed wrote: > > Hi, > > > > On Sat, Jun 13, 2020 at 01:56:15PM +0100, Al Viro wrote: > > > > > Incidentally, what about get_user()/put_user()? _That_ is where it's > > > going to really

Re: [RFC 1/3] lib: copy_{from,to}_user using gup & kmap_atomic()

2020-06-13 Thread Al Viro
On Sat, Jun 13, 2020 at 07:12:36PM +0530, afzal mohammed wrote: > Hi, > > On Sat, Jun 13, 2020 at 01:56:15PM +0100, Al Viro wrote: > > > Incidentally, what about get_user()/put_user()? _That_ is where it's > > going to really hurt... > > All other uaccess routines are also planned to be added,

Re: [RFC 1/3] lib: copy_{from,to}_user using gup & kmap_atomic()

2020-06-13 Thread afzal mohammed
Hi, On Sat, Jun 13, 2020 at 01:56:15PM +0100, Al Viro wrote: > Incidentally, what about get_user()/put_user()? _That_ is where it's > going to really hurt... All other uaccess routines are also planned to be added, posting only copy_{from,to}_user() was to get early feedback (mentioned in the c

Re: [RFC 1/3] lib: copy_{from,to}_user using gup & kmap_atomic()

2020-06-13 Thread afzal mohammed
Hi, On Sat, Jun 13, 2020 at 02:08:11PM +0300, Andy Shevchenko wrote: > On Fri, Jun 12, 2020 at 1:20 PM afzal mohammed > wrote: > > +// Started from arch/um/kernel/skas/uaccess.c > > Does it mean you will deduplicate it there? What i meant was, that file was taken as a template & nothing more,

Re: [RFC 1/3] lib: copy_{from,to}_user using gup & kmap_atomic()

2020-06-13 Thread Russell King - ARM Linux admin
On Sat, Jun 13, 2020 at 05:34:32PM +0530, afzal mohammed wrote: > Hi, > > On Fri, Jun 12, 2020 at 10:07:28PM +0200, Arnd Bergmann wrote: > > > I think a lot > > of usercopy calls are only for a few bytes, though this is of course > > highly workload dependent and you might only care about the lar

Re: [RFC 1/3] lib: copy_{from,to}_user using gup & kmap_atomic()

2020-06-13 Thread Al Viro
On Sat, Jun 13, 2020 at 01:51:26PM +0100, Al Viro wrote: > On Sat, Jun 13, 2020 at 05:34:32PM +0530, afzal mohammed wrote: > > > Observation is that max. pages reaching copy_{from,to}_user() is 2, > > observed maximum of n (number of bytes) being 1 page size. i think C > > library cuts any size re

Re: [RFC 1/3] lib: copy_{from,to}_user using gup & kmap_atomic()

2020-06-13 Thread Al Viro
On Sat, Jun 13, 2020 at 05:34:32PM +0530, afzal mohammed wrote: > Observation is that max. pages reaching copy_{from,to}_user() is 2, > observed maximum of n (number of bytes) being 1 page size. i think C > library cuts any size read, write to page size (if it exceeds) & > invokes the system call.

Re: [RFC 1/3] lib: copy_{from,to}_user using gup & kmap_atomic()

2020-06-13 Thread afzal mohammed
Hi, On Fri, Jun 12, 2020 at 10:07:28PM +0200, Arnd Bergmann wrote: > I think a lot > of usercopy calls are only for a few bytes, though this is of course > highly workload dependent and you might only care about the large > ones. Observation is that max. pages reaching copy_{from,to}_user() is 2

Re: [RFC 1/3] lib: copy_{from,to}_user using gup & kmap_atomic()

2020-06-13 Thread Andy Shevchenko
On Fri, Jun 12, 2020 at 1:20 PM afzal mohammed wrote: > > copy_{from,to}_user() uaccess helpers are implemented by user page > pinning, followed by temporary kernel mapping & then memcpy(). This > helps to achieve user page copy when current virtual address mapping > of the CPU excludes user pages

Re: [RFC 1/3] lib: copy_{from,to}_user using gup & kmap_atomic()

2020-06-12 Thread Arnd Bergmann
On Fri, Jun 12, 2020 at 3:55 PM afzal mohammed wrote: > On Fri, Jun 12, 2020 at 02:02:13PM +0200, Arnd Bergmann wrote: > > On Fri, Jun 12, 2020 at 12:18 PM afzal mohammed > > wrote: > > > > Roughly a one-third drop in performance. Disabling highmem improves > > > performance only slightly. > > >

Re: [RFC 1/3] lib: copy_{from,to}_user using gup & kmap_atomic()

2020-06-12 Thread afzal mohammed
Hi, On Fri, Jun 12, 2020 at 02:02:13PM +0200, Arnd Bergmann wrote: > On Fri, Jun 12, 2020 at 12:18 PM afzal mohammed > wrote: > > Roughly a one-third drop in performance. Disabling highmem improves > > performance only slightly. > There are probably some things that can be done to optimize it,

Re: [RFC 1/3] lib: copy_{from,to}_user using gup & kmap_atomic()

2020-06-12 Thread Arnd Bergmann
On Fri, Jun 12, 2020 at 12:18 PM afzal mohammed wrote: > > copy_{from,to}_user() uaccess helpers are implemented by user page > pinning, followed by temporary kernel mapping & then memcpy(). This > helps to achieve user page copy when current virtual address mapping > of the CPU excludes user page

[RFC 1/3] lib: copy_{from,to}_user using gup & kmap_atomic()

2020-06-12 Thread afzal mohammed
copy_{from,to}_user() uaccess helpers are implemented by user page pinning, followed by temporary kernel mapping & then memcpy(). This helps to achieve user page copy when current virtual address mapping of the CPU excludes user pages. Performance wise, results are not encouraging, 'dd' on tmpfs r