Received: by 2002:a4f:b056:0:0:0:0:0 with SMTP id m22csp1409426ivi; Fri, 2 Oct 2020 09:23:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwW5LURXS4QQcVJWnm5o/26/uoifeMabF2AxWGkWeGVbRo/gyezfxBhCRYuLQeuE8vbE9s6 X-Received: by 2002:a05:6402:3c8:: with SMTP id t8mr3112292edw.266.1601655820886; Fri, 02 Oct 2020 09:23:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601655820; cv=none; d=google.com; s=arc-20160816; b=LetjIKs5y+8hQcc6OFM15y5P/grl4xUvnqcRHtDRBkoRmNB6jFpNe++jKKRg9u8Byp 205aM9vT+TqH9uFpTLqfvp6BEH6j43V9v8pZ3E9CPWWmd537EE3Hg5zcrOZxDUhg/aJ7 6PThofROfVwTLj8FEJ33UtZkIcOiXLlCedE7DH7xNHRNX0oKldZwIBxQutsgELVCxd0E Sf5bYMkL5NM+PY6MT1esjleOIbfwCWJVo2cxjqAtRkFwoXBSTCWcB/wJdZ5ifDec1PEb s7YuP4qMWd2TlTtXHlSwi2noCTSjBG6Yi2PS9FU1BCV6Im2NkOYWloS+ZgGyN461iUkW BsZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:cc:from:subject:references:mime-version :message-id:in-reply-to:date:sender:dkim-signature; bh=KNj3DAoXl6FY4HLNmjfsIeWPw6NmzA5m1h25nAFriyA=; b=LdWkx/x8SgXD3BZ6n71SLrv8Rrm7eKHqv3IaOfOWcbvxYym7VNa6xUWGsRb25PNOwy ETd5uWgeyMj0VoeIOtFnu5LO6Jq1chcoLDr4gmClK1WGmh9PivO0nzIhcd+otRV4XqKo q8E3MQuqg8pJpDcoy0LWbJFac7BcTn1B9S2MuWPCAMqYcjw5lJ1HvPv59OyBB9ehOm47 5peiNqQ3lzcCYHCxGJ25eZ6stsV4l3mz0tnNmzrJaXs811QaUDeELHBhCgkOZoh9Y2oC waEKe9x0Tp4eKA8e07hlScNXpK+wPaMdihA89xxE2wUWFORauNfk84yrTyZuQ67Fsqhs 4LhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=SWSITLXo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id o21si1315466ejg.255.2020.10.02.09.23.17; Fri, 02 Oct 2020 09:23:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=SWSITLXo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S2388160AbgJBQVm (ORCPT + 99 others); Fri, 2 Oct 2020 12:21:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726386AbgJBQVj (ORCPT ); Fri, 2 Oct 2020 12:21:39 -0400 Received: from mail-qk1-x74a.google.com (mail-qk1-x74a.google.com [IPv6:2607:f8b0:4864:20::74a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6117DC0613D0 for ; Fri, 2 Oct 2020 09:21:39 -0700 (PDT) Received: by mail-qk1-x74a.google.com with SMTP id 139so1419153qkl.11 for ; Fri, 02 Oct 2020 09:21:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:cc; bh=KNj3DAoXl6FY4HLNmjfsIeWPw6NmzA5m1h25nAFriyA=; b=SWSITLXoYBp7yRaYvXhJIOfUQ0+WxGu3JpdKX8dFE/fNTZMF6v5PFDYR3jy8+MgdQp tZLS7uiyPoGn0n+djf+PmvNOiiJwUEN4ag80gUHytq35k8ckK5drIIgveVqH2KnxvRuE IyUED/LyVYcy2WCy1ZkMbWXSC9CDXV9hhBXgKCTGP+Mnje71NVfxQO3Xij6heAQX7jrS vn+BJAXlRI1RmkPGQrml2YmXHCtztRAiTmms9bKK5lTEZ/yy4sLAktgaEfNF/ahlLzl9 p+IwrlzofYdi0hKb/8nRKjmW7dlqF/dg521zphFh3XOYiNFj/lK/lt5f89D9bOEWgfNX QhQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:cc; bh=KNj3DAoXl6FY4HLNmjfsIeWPw6NmzA5m1h25nAFriyA=; b=dmAKGomEyuPSSsml6yVPsD5XlTODzvX/93ShJMM/bI2paiZHEJbLIfQf7wYeyiidaH UbgdTw7bIXnUdSSjSmxqbiUg+KV5Y05xCA5KBgSlailIYOu3szsUZYDBVIQdB9zclVmR fUnW0JplBg0mesBu2Bw5EDWkcfN+q3eOunma4Hx2kBiTM/fj/4GSxrGuk7EEDZ/YVrM4 CoAxykLPnDAnH9BYlV0V/rO4ZluDFXQiFe1FzPikrAVwM99LcKTU8h2t3zzS9eGjPsYP 3mn3CDo5ocBwEzwyelJrmqJpxgaK+fUPsBnDZ9r79i+e2P1YOoLXLEL+9K+HrYTn/SBF w2uw== X-Gm-Message-State: AOAM530xr84nZIagHxfc4BqaaT88Bzsj97vCl4igorrmzM5PRNluSgVg MDwsSDXCxERGmm8kUDgehIJclrjPpwG7BwYUwQ== Sender: "kaleshsingh via sendgmr" X-Received: from kaleshsingh.c.googlers.com ([fda3:e722:ac3:10:14:4d90:c0a8:2145]) (user=kaleshsingh job=sendgmr) by 2002:ad4:4b34:: with SMTP id s20mr2944829qvw.51.1601655698451; Fri, 02 Oct 2020 09:21:38 -0700 (PDT) Date: Fri, 2 Oct 2020 16:20:47 +0000 In-Reply-To: <20201002162101.665549-1-kaleshsingh@google.com> Message-Id: <20201002162101.665549-3-kaleshsingh@google.com> Mime-Version: 1.0 References: <20201002162101.665549-1-kaleshsingh@google.com> X-Mailer: git-send-email 2.28.0.806.g8561365e88-goog Subject: [PATCH v2 2/6] arm64: mremap speedup - Enable HAVE_MOVE_PMD From: Kalesh Singh Cc: surenb@google.com, minchan@google.com, joelaf@google.com, lokeshgidra@google.com, kaleshsingh@google.com, kernel-team@android.com, Catalin Marinas , Will Deacon , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" , Andrew Morton , Shuah Khan , "Aneesh Kumar K.V" , Kees Cook , Peter Zijlstra , Masahiro Yamada , Arnd Bergmann , Sami Tolvanen , Frederic Weisbecker , Krzysztof Kozlowski , Hassan Naveed , Christian Brauner , Stephen Boyd , Mark Rutland , Mike Rapoport , Gavin Shan , Mark Brown , Jia He , Zhenyu Ye , John Hubbard , Dave Hansen , Zi Yan , Jason Gunthorpe , Ralph Campbell , "Kirill A. Shutemov" , Mina Almasry , Sandipan Das , Colin Ian King , Ram Pai , Masami Hiramatsu , SeongJae Park , Ira Weiny , Brian Geffon , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org Content-Type: text/plain; charset="UTF-8" To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org HAVE_MOVE_PMD enables remapping pages at the PMD level if both the source and destination addresses are PMD-aligned. HAVE_MOVE_PMD is already enabled on x86. The original patch [1] that introduced this config did not enable it on arm64 at the time because of performance issues with flushing the TLB on every PMD move. These issues have since been addressed in more recent releases with improvements to the arm64 TLB invalidation and core mmu_gather code as Will Deacon mentioned in [2]. From the data below, it can be inferred that there is approximately 8x improvement in performance when HAVE_MOVE_PMD is enabled on arm64. --------- Test Results ---------- The following results were obtained on an arm64 device running a 5.4 kernel, by remapping a PMD-aligned, 1GB sized region to a PMD-aligned destination. The results from 10 iterations of the test are given below. All times are in nanoseconds. Control HAVE_MOVE_PMD 9220833 1247761 9002552 1219896 9254115 1094792 8725885 1227760 9308646 1043698 9001667 1101771 8793385 1159896 8774636 1143594 9553125 1025833 9374010 1078125 9100885.4 1134312.6 <-- Mean Time in nanoseconds Total mremap time for a 1GB sized PMD-aligned region drops from ~9.1 milliseconds to ~1.1 milliseconds. (~8x speedup). [1] https://lore.kernel.org/r/20181108181201.88826-3-joelaf@google.com [2] https://www.mail-archive.com/linuxppc-dev@lists.ozlabs.org/msg140837.html Signed-off-by: Kalesh Singh --- arch/arm64/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 6d232837cbee..844d089668e3 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -121,6 +121,7 @@ config ARM64 select GENERIC_VDSO_TIME_NS select HANDLE_DOMAIN_IRQ select HARDIRQS_SW_RESEND + select HAVE_MOVE_PMD select HAVE_PCI select HAVE_ACPI_APEI if (ACPI && EFI) select HAVE_ALIGNED_STRUCT_PAGE if SLUB -- 2.28.0.806.g8561365e88-goog