Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1451633imm; Fri, 12 Oct 2018 19:26:03 -0700 (PDT) X-Google-Smtp-Source: ACcGV624cB/i+fI3QX798w3eGeBxsASXaLKe+4E8x9OF9mgQfgQxyoTuHF+Bo6nh1ROQHGhGXIsI X-Received: by 2002:a62:5f05:: with SMTP id t5-v6mr8544755pfb.223.1539397563200; Fri, 12 Oct 2018 19:26:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539397563; cv=none; d=google.com; s=arc-20160816; b=0EVHNs1bscUcMpsPh5g+d7KM6zoXEb2JwA+WhS0LIQgeSDCZPJ+hdZreCAeD2wE8kB lEBkhMI8ZYZxKjoOcmubdsQsruabAVtkvLlE6xCtAVZiZwUVUR+CmQ681IlatVVD2dzZ oeUOU5NJwJdM3oIOplxK44++kdRmx5DB+bN4gL/H3GK1zX9/mPu6IgXoL70of/7liMqU e1CVn08IfKsulC0004zGaQtCxFcnxNh3KhmeNHXKSjIXMsAyEhRIDQTeP/OfFneewbnT 28vh4eHfFrh3akDh+Ee3YM0xwPmrUa761ObeaIMSWgjjScyzO5hFse+2zntpTui8VcTR +79w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature; bh=AVT8yt4SB5J9DoLXgmc7fyXmf+sZ/QolyovgztLAQ10=; b=J1PiMmCgRSE5qCnh9CBdT8YRUF5QL8b1uYqi4cvGV9ufweYqcbnCaBlB7nonHGv2ZU KFWtZAyx8dUb/0qAbHGo4X5xKHWzNer4ACqxUJ6S3FtroJWp3LjZaexOUet6Hu/tMRWw WUnoys36owrd7tAxA7jg+9oAZrYEfzxKi3FxjQ4tjW3bgJEUctEloOUC/hNhMj7h55rt p77bLFOroWYqpgIyGjLTYTd5mpOoedq2s10fgftRQCJq5nEEFIDCHyGoJ8LMqW9oy2NA BDSWXOkOoSTltIkXCIyvZGHFgJoZK/lOkSR5DcWqvPP731irYJjv93n/kRIkT13U37d7 H/cA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=uV2twWkm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u22-v6si3352791plk.293.2018.10.12.19.25.47; Fri, 12 Oct 2018 19:26:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=uV2twWkm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726287AbeJMKA3 (ORCPT + 99 others); Sat, 13 Oct 2018 06:00:29 -0400 Received: from mail-ot1-f68.google.com ([209.85.210.68]:39272 "EHLO mail-ot1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726005AbeJMKA2 (ORCPT ); Sat, 13 Oct 2018 06:00:28 -0400 Received: by mail-ot1-f68.google.com with SMTP id l58so14121604otd.6 for ; Fri, 12 Oct 2018 19:25:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=AVT8yt4SB5J9DoLXgmc7fyXmf+sZ/QolyovgztLAQ10=; b=uV2twWkmECSPrusRnN/vXPmvBFYTjOqR8hUGj7uFIqFnja6HWyEE59/EX6URRSK7ei bsLQO8pq96Yj7M5G0CjsRbi5afMpRO5p6LGi6gqkF1Fsb96X2cpi7a6HzEjPHM5S5b/+ frAsPOqLD9LWEf7OVOqxvcQcS5euFpCDZTZ4mQNwNIu+I5BIdazSX176UsMrE2WE7yqy vEzD1H9jpf2yN7Z39bZVobe1cuQmeBj/6yYghOi4Eg5BRvkIX/X2/Np9eIx+7MbesZ3i M/WKTCz0rPGomijvt/NLvxi250WzkhscHNYFINjgKIa6h6fyG7Vk/yjb5v+LZqg963lC Fyng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=AVT8yt4SB5J9DoLXgmc7fyXmf+sZ/QolyovgztLAQ10=; b=iO3iQcf9MSDHNE/4t8xHu6Q3sWW/OMv886ZyPBw+nOwQNsPfxyQb2lK5tDsU5Gesun MW0w65fnERfJXE/zQyftw5kqy3wpRJt5mr6qnuINti/LHe0v+s8v/FCuaPLYho5swfY7 ef5J+I0zUgFf9DjRBGeIJD9i0eHhtQLKKVcSPCBhemSSS6KLcZqTVNSvO/fulL8offzd A1OukEV0YOJ2uk34FzvAT7uNsD5aRwqYcBYOXXdvde7jmfthwLqLHub6IqvIldnJGGIc +Pzd0RhKw5pNpx8p6QQKjyzFyAoIPLo9M7Exr5mT24U4nn+UcDdAqNatMXJbXCk9oSP0 xOnQ== X-Gm-Message-State: ABuFfoiHWtAmjM9y6JznS6ixTrapOz2OrCgyKDL/NIY2kfgSJWNv4Ulf tk5toBx4AStGfML400YgO0vkwHyHyTZxIoTC7N49gA== X-Received: by 2002:a9d:62cb:: with SMTP id z11mr5748873otk.342.1539397509267; Fri, 12 Oct 2018 19:25:09 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ac9:56d8:0:0:0:0:0 with HTTP; Fri, 12 Oct 2018 19:25:08 -0700 (PDT) In-Reply-To: <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> <20181013021057.GA213522@joelaf.mtv.corp.google.com> From: Daniel Colascione Date: Fri, 12 Oct 2018 19:25:08 -0700 Message-ID: Subject: Re: [PATCH v2 2/2] mm: speed up mremap by 500x on large regions To: Joel Fernandes Cc: David Miller , kirill@shutemov.name, linux-kernel , kernel-team@android.com, Minchan Kim , Ramon Pantin , Hugh Dickins , Lokesh Gidra , Michal Hocko , Andrew Morton , aryabinin@virtuozzo.com, luto@kernel.org, bp@alien8.de, catalin.marinas@arm.com, Chris Zankel , 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 Bonn , Julia Lawall , 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, Max Filippov , nios2-dev@lists.rocketboards.org, Peter Zijlstra , richard@nod.at Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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 Guilty as charged. I really should switch back to Gnus. :-) > 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. Ah, I think the commit message is confusing. (Or else I'm misreading the patch now.) It's not quite that we're disabling the feature when THP is enabled anywhere, but rather that we use the move_huge_pmd path for huge PMDs and use the new code only for non-huge PMDs. (Right?) If that's the case, the commit message shouldn't say "Incase THP is enabled, the optimization is skipped". Even if THP is enabled on a system generally, we might use the new PMD-moving code for mapping types that don't support THP-ization, right? > 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. Sure. I'm just pointing out that the 500x performance different turns the operation into a qualitatively different feature, so if we expect to actually ship a mainstream architecture without support for this thing, we should make it explicit. If we're not, we shouldn't.