From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by kanga.kvack.org (Postfix) with ESMTP id A27E66B0003 for ; Fri, 12 Oct 2018 22:11:01 -0400 (EDT) Received: by mail-pf1-f199.google.com with SMTP id l1-v6so13641384pfb.7 for ; Fri, 12 Oct 2018 19:11:01 -0700 (PDT) Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id z18-v6sor2825462pgk.58.2018.10.12.19.11.00 for (Google Transport Security); Fri, 12 Oct 2018 19:11:00 -0700 (PDT) Date: Fri, 12 Oct 2018 19:10:57 -0700 From: Joel Fernandes Subject: Re: [PATCH v2 2/2] mm: speed up mremap by 500x on large regions Message-ID: <20181013021057.GA213522@joelaf.mtv.corp.google.com> References: <20181012013756.11285-2-joel@joelfernandes.org> <20181012113056.gxhcbrqyu7k7xnyv@kshutemo-mobl1> <20181012125046.GA170912@joelaf.mtv.corp.google.com> <20181012.111836.1569129998592378186.davem@davemloft.net> <20181013013540.GA207108@joelaf.mtv.corp.google.com> <20181013014429.GB207108@joelaf.mtv.corp.google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: owner-linux-mm@kvack.org List-ID: To: Daniel Colascione Cc: David Miller , kirill@shutemov.name, linux-kernel , kernel-team@android.com, Minchan Kim , Ramon Pantin , hughd@google.com, Lokesh Gidra , Michal Hocko , Andrew Morton , aryabinin@virtuozzo.com, luto@kernel.org, bp@alien8.de, catalin.marinas@arm.com, chris@zankel.net, dave.hansen@linux.intel.com, elfring@users.sourceforge.net, fenghua.yu@intel.com, geert@linux-m68k.org, gxt@pku.edu.cn, deller@gmx.de, mingo@redhat.com, jejb@parisc-linux.org, jdike@addtoit.com, jonas@southpole.se, Julia.Lawall@lip6.fr, kasan-dev@googlegroups.com, kvmarm@lists.cs.columbia.edu, lftan@altera.com, linux-alpha@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@linux-mips.org, linux-mm , linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, linux-snps-arc@lists.infradead.org, linux-um@lists.infradead.org, linux-xtensa@linux-xtensa.org, jcmvbkbc@gmail.com, nios2-dev@lists.rocketboards.org, Peter Zijlstra , richard@nod.at 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 feature entirely rather than blindly use mremap and end up > performing very poorly. If we're disabling fast mremap when THP is > enabled, the userland component can't just rely on an architecture > switch and some kind of runtime feature detection becomes even more > important. I hate to point out that its forbidden to top post on LKML :-) https://kernelnewbies.org/mailinglistguidelines So don't that Mr. Dan! :D But anyway, I think this runtime detection thing is not needed. THP is actually expected to be as fast as this anyway, so if that's available then we should already be as fast. This is for non-THP where THP cannot be enabled and there is still room for some improvement. Most/all architectures will be just fine with this. This flag is more of a safety-net type of thing where in the future if there is this one or two weird architectures that don't play well, then they can turn it off at the architecture level by not selecting the flag. See my latest patches for the per-architecture compile-time controls. Ideally we'd like to blanket turn it on on all, but this is just playing it extra safe as Kirill and me were discussing on other threads. thanks! - Joel