Re: [PATCH v2 2/2] mm: speed up mremap by 500x on large regions

2018-10-12 Thread Anton Ivanov
On 12/10/2018 22:40, Kirill A. Shutemov wrote: On Fri, Oct 12, 2018 at 05:42:24PM +0100, Anton Ivanov wrote: On 10/12/18 3:48 PM, Anton Ivanov wrote: On 12/10/2018 15:37, Kirill A. Shutemov wrote: On Fri, Oct 12, 2018 at 03:09:49PM +0100, Anton Ivanov wrote: On 10/12/18 2:37 AM, Joel Fernande

Re: [PATCH v2 2/2] mm: speed up mremap by 500x on large regions

2018-10-12 Thread Daniel Colascione
On Fri, Oct 12, 2018 at 7:10 PM, Joel Fernandes wrote: > On Fri, Oct 12, 2018 at 06:54:33PM -0700, Daniel Colascione wrote: >> I wonder whether it makes sense to expose to userspace somehow whether >> mremap is "fast" for a particular architecture. If a feature relies on >> fast mremap, it might b

Re: [PATCH v2 2/2] mm: speed up mremap by 500x on large regions

2018-10-12 Thread Joel Fernandes
On Fri, Oct 12, 2018 at 06:54:33PM -0700, Daniel Colascione wrote: > I wonder whether it makes sense to expose to userspace somehow whether > mremap is "fast" for a particular architecture. If a feature relies on > fast mremap, it might be better for some userland component to disable > that featur

Re: [PATCH v2 2/2] mm: speed up mremap by 500x on large regions

2018-10-12 Thread Daniel Colascione
I wonder whether it makes sense to expose to userspace somehow whether mremap is "fast" for a particular architecture. If a feature relies on fast mremap, it might be better for some userland component to disable that feature entirely rather than blindly use mremap and end up performing very poorly

Re: [PATCH v2 2/2] mm: speed up mremap by 500x on large regions

2018-10-12 Thread Joel Fernandes
On Fri, Oct 12, 2018 at 06:39:45PM -0700, Daniel Colascione wrote: > Not 32-bit ARM? Well, I didn't want to enable every possible architecture we could in a single go. Certainly arm32 can be a follow on enablement as can be other architectures. The point of this series is to upstream this feature

Re: [PATCH v2 2/2] mm: speed up mremap by 500x on large regions

2018-10-12 Thread Daniel Colascione
Not 32-bit ARM? On Fri, Oct 12, 2018 at 6:35 PM, Joel Fernandes wrote: > On Fri, Oct 12, 2018 at 11:18:36AM -0700, David Miller wrote: >> From: Joel Fernandes > [...] >> > Also, do we not flush the caches from any path when we munmap >> > address space? We do call do_munmap on the old mapping f

Re: [PATCH v2 2/2] mm: speed up mremap by 500x on large regions

2018-10-12 Thread Joel Fernandes
On Fri, Oct 12, 2018 at 11:18:36AM -0700, David Miller wrote: > From: Joel Fernandes [...] > > Also, do we not flush the caches from any path when we munmap > > address space? We do call do_munmap on the old mapping from mremap > > after moving to the new one. > > Sparc makes sure that shared ma

[PATCH 1/4] treewide: remove unused address argument from pte_alloc functions (v2)

2018-10-12 Thread Joel Fernandes (Google)
This series speeds up mremap(2) syscall by copying page tables at the PMD level even for non-THP systems. There is concern that the extra 'address' argument that mremap passes to pte_alloc may do something subtle architecture related in the future that may make the scheme not work. Also we find th

[PATCH 4/4] x86: select HAVE_MOVE_PMD for faster mremap (v1)

2018-10-12 Thread Joel Fernandes (Google)
Moving page-tables at the PMD-level on x86 is known to be safe. Enable this option so that we can do fast mremap when possible. Signed-off-by: Joel Fernandes (Google) --- arch/x86/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 1a0be022f91d..

[PATCH 2/4] mm: speed up mremap by 500x on large regions (v2)

2018-10-12 Thread Joel Fernandes (Google)
Android needs to mremap large regions of memory during memory management related operations. The mremap system call can be really slow if THP is not enabled. The bottleneck is move_page_tables, which is copying each pte at a time, and can be really slow across a large map. Turning on THP may not be

[PATCH 3/4] arm64: select HAVE_MOVE_PMD for faster mremap (v1)

2018-10-12 Thread Joel Fernandes (Google)
Moving page-tables at the PMD-level on arm64 is known to be safe. Enable this option so that we can do fast mremap when possible. Signed-off-by: Joel Fernandes (Google) --- arch/arm64/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 1b1a0e

[PATCH 0/4] Add support for fast mremap

2018-10-12 Thread Joel Fernandes (Google)
Hi, Here is the latest "fast mremap" series. The main change in this submission is to enable the fast mremap optimization on a per-architecture basis to prevent possible issues with architectures that may not behave well with such change. x86: select HAVE_MOVE_PMD for faster mremap (v1) arm64: se

Re: [PATCH v2 2/2] mm: speed up mremap by 500x on large regions

2018-10-12 Thread Kirill A. Shutemov
On Fri, Oct 12, 2018 at 05:42:24PM +0100, Anton Ivanov wrote: > > On 10/12/18 3:48 PM, Anton Ivanov wrote: > > On 12/10/2018 15:37, Kirill A. Shutemov wrote: > > > On Fri, Oct 12, 2018 at 03:09:49PM +0100, Anton Ivanov wrote: > > > > On 10/12/18 2:37 AM, Joel Fernandes (Google) wrote: > > > > > An

Re: [PATCH v2 2/2] mm: speed up mremap by 500x on large regions

2018-10-12 Thread Kirill A. Shutemov
On Fri, Oct 12, 2018 at 09:57:19AM -0700, Joel Fernandes wrote: > On Fri, Oct 12, 2018 at 04:19:46PM +0300, Kirill A. Shutemov wrote: > > On Fri, Oct 12, 2018 at 05:50:46AM -0700, Joel Fernandes wrote: > > > On Fri, Oct 12, 2018 at 02:30:56PM +0300, Kirill A. Shutemov wrote: > > > > On Thu, Oct 11,

Re: [PATCH v2 1/2] treewide: remove unused address argument from pte_alloc functions

2018-10-12 Thread Joel Fernandes
On Fri, Oct 12, 2018 at 08:51:45PM +0200, SF Markus Elfring wrote: > > The changes were obtained by applying the following Coccinelle script. > > A bit of clarification happened for its implementation details. > https://systeme.lip6.fr/pipermail/cocci/2018-October/005374.html > > I have taken als

Re: [PATCH 12/18] arch/tlb: Clean up simple architectures

2018-10-12 Thread Vineet Gupta
On 10/11/2018 08:06 AM, Peter Zijlstra wrote: > On Wed, Oct 03, 2018 at 05:03:50PM +, Vineet Gupta wrote: >> On 09/26/2018 04:56 AM, Peter Zijlstra wrote: >>> There are generally two cases: >>> >>> 1) either the platform has an efficient flush_tlb_range() and >>> asm-generic/tlb.h doesn't

Re: [PATCH v2 1/2] treewide: remove unused address argument from pte_alloc functions

2018-10-12 Thread SF Markus Elfring
> The changes were obtained by applying the following Coccinelle script. A bit of clarification happened for its implementation details. https://systeme.lip6.fr/pipermail/cocci/2018-October/005374.html I have taken also another look at the following SmPL code. > identifier fn =~ > "^(__pte_allo

Re: [PATCH v2 2/2] mm: speed up mremap by 500x on large regions

2018-10-12 Thread David Miller
From: Joel Fernandes Date: Fri, 12 Oct 2018 05:50:46 -0700 > If its an issue, then how do transparent huge pages work on Sparc? I don't > see the huge page code (move_huge_pages) during mremap doing anything special > for Sparc architecture when moving PMDs.. This is because all huge pages are

Re: [PATCH v2 2/2] mm: speed up mremap by 500x on large regions

2018-10-12 Thread David Miller
From: "Kirill A. Shutemov" Date: Fri, 12 Oct 2018 14:30:56 +0300 > I looked into the code more and noticed move_pte() helper called from > move_ptes(). It changes PTE entry to suite new address. > > It is only defined in non-trivial way on Sparc. I don't know much about > Sparc and it's hard for

Re: [PATCH v2 2/2] mm: speed up mremap by 500x on large regions

2018-10-12 Thread Joel Fernandes
On Fri, Oct 12, 2018 at 05:58:40PM +0100, Anton Ivanov wrote: [...] > > > > > > If I read the code right, MIPS completely ignores the address > > > > > > argument so > > > > > > set_pmd_at there may not have the effect which this patch is trying > > > > > > to > > > > > > achieve. > > > > > Ignori

Re: [PATCH v2 2/2] mm: speed up mremap by 500x on large regions

2018-10-12 Thread Anton Ivanov
On 10/12/18 5:50 PM, Joel Fernandes wrote: On Fri, Oct 12, 2018 at 05:42:24PM +0100, Anton Ivanov wrote: On 10/12/18 3:48 PM, Anton Ivanov wrote: On 12/10/2018 15:37, Kirill A. Shutemov wrote: On Fri, Oct 12, 2018 at 03:09:49PM +0100, Anton Ivanov wrote: On 10/12/18 2:37 AM, Joel Fernandes (

Re: [PATCH v2 2/2] mm: speed up mremap by 500x on large regions

2018-10-12 Thread Joel Fernandes
On Fri, Oct 12, 2018 at 04:19:46PM +0300, Kirill A. Shutemov wrote: > On Fri, Oct 12, 2018 at 05:50:46AM -0700, Joel Fernandes wrote: > > On Fri, Oct 12, 2018 at 02:30:56PM +0300, Kirill A. Shutemov wrote: > > > On Thu, Oct 11, 2018 at 06:37:56PM -0700, Joel Fernandes (Google) wrote: > > > > Androi

Re: [PATCH v2 2/2] mm: speed up mremap by 500x on large regions

2018-10-12 Thread Joel Fernandes
On Fri, Oct 12, 2018 at 05:42:24PM +0100, Anton Ivanov wrote: > > On 10/12/18 3:48 PM, Anton Ivanov wrote: > > On 12/10/2018 15:37, Kirill A. Shutemov wrote: > > > On Fri, Oct 12, 2018 at 03:09:49PM +0100, Anton Ivanov wrote: > > > > On 10/12/18 2:37 AM, Joel Fernandes (Google) wrote: > > > > > An

Re: [PATCH v2 1/2] treewide: remove unused address argument from pte_alloc functions

2018-10-12 Thread Joel Fernandes
On Fri, Oct 12, 2018 at 06:38:57PM +0200, Julia Lawall wrote: > > I wrote something like this as below but it failed to compile, Julia any > > suggestions on how to express this? > > > > @pte_alloc_func_proto depends on patch exists@ > > type T1, T2, T3, T4; > > identifier fn =~ > > "^(__pte_alloc|

Re: [PATCH v2 2/2] mm: speed up mremap by 500x on large regions

2018-10-12 Thread Anton Ivanov
On 10/12/18 3:48 PM, Anton Ivanov wrote: On 12/10/2018 15:37, Kirill A. Shutemov wrote: On Fri, Oct 12, 2018 at 03:09:49PM +0100, Anton Ivanov wrote: On 10/12/18 2:37 AM, Joel Fernandes (Google) wrote: Android needs to mremap large regions of memory during memory management related operations

Re: [PATCH v2 1/2] treewide: remove unused address argument from pte_alloc functions

2018-10-12 Thread Julia Lawall
> I wrote something like this as below but it failed to compile, Julia any > suggestions on how to express this? > > @pte_alloc_func_proto depends on patch exists@ > type T1, T2, T3, T4; > identifier fn =~ > "^(__pte_alloc|pte_alloc_one|pte_alloc|__pte_alloc_kernel|pte_alloc_one_kernel)$"; > @@ > >

Re: [PATCH v2 1/2] treewide: remove unused address argument from pte_alloc functions

2018-10-12 Thread Joel Fernandes
On Fri, Oct 12, 2018 at 02:09:06PM +0300, Kirill A. Shutemov wrote: > On Thu, Oct 11, 2018 at 06:37:55PM -0700, Joel Fernandes (Google) wrote: > > diff --git a/arch/m68k/include/asm/mcf_pgalloc.h > > b/arch/m68k/include/asm/mcf_pgalloc.h > > index 12fe700632f4..4399d712f6db 100644 > > --- a/arch/m

Re: [PATCH v2 1/2] treewide: remove unused address argument from pte_alloc functions

2018-10-12 Thread Joel Fernandes
On Fri, Oct 12, 2018 at 02:56:19PM +0100, Anton Ivanov wrote: > > On 10/12/18 2:37 AM, Joel Fernandes (Google) wrote: > > This series speeds up mremap(2) syscall by copying page tables at the > > PMD level even for non-THP systems. There is concern that the extra > > 'address' argument that mremap

Re: [PATCH v2 2/2] mm: speed up mremap by 500x on large regions

2018-10-12 Thread Anton Ivanov
On 12/10/2018 15:37, Kirill A. Shutemov wrote: On Fri, Oct 12, 2018 at 03:09:49PM +0100, Anton Ivanov wrote: On 10/12/18 2:37 AM, Joel Fernandes (Google) wrote: Android needs to mremap large regions of memory during memory management related operations. The mremap system call can be really slow

Re: [PATCH v2 2/2] mm: speed up mremap by 500x on large regions

2018-10-12 Thread Kirill A. Shutemov
On Fri, Oct 12, 2018 at 03:09:49PM +0100, Anton Ivanov wrote: > On 10/12/18 2:37 AM, Joel Fernandes (Google) wrote: > > Android needs to mremap large regions of memory during memory management > > related operations. The mremap system call can be really slow if THP is > > not enabled. The bottlenec

Re: [PATCH v2 2/2] mm: speed up mremap by 500x on large regions

2018-10-12 Thread Anton Ivanov
On 10/12/18 2:37 AM, Joel Fernandes (Google) wrote: Android needs to mremap large regions of memory during memory management related operations. The mremap system call can be really slow if THP is not enabled. The bottleneck is move_page_tables, which is copying each pte at a time, and can be rea

Re: [PATCH v2 1/2] treewide: remove unused address argument from pte_alloc functions

2018-10-12 Thread Anton Ivanov
On 10/12/18 2:37 AM, Joel Fernandes (Google) wrote: This series speeds up mremap(2) syscall by copying page tables at the PMD level even for non-THP systems. There is concern that the extra 'address' argument that mremap passes to pte_alloc may do something subtle architecture related in the fu

Re: [PATCH v2 2/2] mm: speed up mremap by 500x on large regions

2018-10-12 Thread Kirill A. Shutemov
On Fri, Oct 12, 2018 at 05:50:46AM -0700, Joel Fernandes wrote: > On Fri, Oct 12, 2018 at 02:30:56PM +0300, Kirill A. Shutemov wrote: > > On Thu, Oct 11, 2018 at 06:37:56PM -0700, Joel Fernandes (Google) wrote: > > > Android needs to mremap large regions of memory during memory management > > > rel

Re: [PATCH v2 2/2] mm: speed up mremap by 500x on large regions

2018-10-12 Thread Joel Fernandes
On Fri, Oct 12, 2018 at 02:30:56PM +0300, Kirill A. Shutemov wrote: > On Thu, Oct 11, 2018 at 06:37:56PM -0700, Joel Fernandes (Google) wrote: > > Android needs to mremap large regions of memory during memory management > > related operations. The mremap system call can be really slow if THP is > >

Re: [PATCH v2] ARC: HSDK: improve reset driver

2018-10-12 Thread Philipp Zabel
Hi Eugeniy, thank you for the update. On Fri, 2018-09-28 at 19:28 +0300, Eugeniy Paltsev wrote: > As for today HSDK reset driver implements only > .reset() callback. > > In case of driver which implements one of standard > reset controller usage pattern > (call *_deassert() in probe(), call *_as

Re: [PATCH v2 2/2] mm: speed up mremap by 500x on large regions

2018-10-12 Thread Kirill A. Shutemov
On Fri, Oct 12, 2018 at 02:30:56PM +0300, Kirill A. Shutemov wrote: > On Thu, Oct 11, 2018 at 06:37:56PM -0700, Joel Fernandes (Google) wrote: > > @@ -239,7 +287,21 @@ unsigned long move_page_tables(struct vm_area_struct > > *vma, > > split_huge_pmd(vma, old_pmd, old_addr); > >

Re: [PATCH v2 2/2] mm: speed up mremap by 500x on large regions

2018-10-12 Thread Kirill A. Shutemov
On Thu, Oct 11, 2018 at 06:37:56PM -0700, Joel Fernandes (Google) wrote: > Android needs to mremap large regions of memory during memory management > related operations. The mremap system call can be really slow if THP is > not enabled. The bottleneck is move_page_tables, which is copying each > pt

Re: [PATCH v2 1/2] treewide: remove unused address argument from pte_alloc functions

2018-10-12 Thread Kirill A. Shutemov
On Thu, Oct 11, 2018 at 06:37:55PM -0700, Joel Fernandes (Google) wrote: > diff --git a/arch/m68k/include/asm/mcf_pgalloc.h > b/arch/m68k/include/asm/mcf_pgalloc.h > index 12fe700632f4..4399d712f6db 100644 > --- a/arch/m68k/include/asm/mcf_pgalloc.h > +++ b/arch/m68k/include/asm/mcf_pgalloc.h > @@