From patchwork Mon Oct 5 15:40:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kalesh Singh X-Patchwork-Id: 11816885 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9033D6CA for ; Mon, 5 Oct 2020 15:42:56 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5E70820578 for ; Mon, 5 Oct 2020 15:42:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="QM95bEi5"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="G05LJGMS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5E70820578 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:From:Subject:References:Mime-Version:Message-Id: In-Reply-To:Date:Reply-To:To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ve/9G3LR8trHYlZ+xw8avLbex79Eo4W8dqt9QT1XlcU=; b=QM95bEi5HwscmalMX2iBqs3SW iVLFKjr/xJooHmPttJdWcVv2/HgfR9SjO1K+dgs3CZeAI5FqMNyJ4HQzRm5UMAdsmypPd96LjUzJx xmz5NL623U6bW+vPWMnP97FJkhu5Ct2MlnMx1UmsbsuFW/NcNIpT7cZtpa8nUs9xiv1Ub9nWzTRcr lwkbfGzgnVOEfovH9Ml2sHAwQXkEPvE7GmCiQGfiQbklpvXe53buQEV2qh2qLYKOvd8Q82OAvQQWU Eq+3yfpSdvxoAq6whmKTV4AB/DVX3C37p3edAFSdOx/PdXAVdRd1eGiD+T6D0HcnVB0rY/j6O2AdX bq8Te9riA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kPSbe-0001Dj-Nn; Mon, 05 Oct 2020 15:40:54 +0000 Received: from mail-qt1-x84a.google.com ([2607:f8b0:4864:20::84a]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kPSbY-0001A5-Og for linux-arm-kernel@lists.infradead.org; Mon, 05 Oct 2020 15:40:50 +0000 Received: by mail-qt1-x84a.google.com with SMTP id m13so6721014qtu.10 for ; Mon, 05 Oct 2020 08:40:46 -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=G05LJGMSS4nGQxD55nnPiFMozAlJTpF0Yva9yVs0JE0FGn+2WW0CmY9ZOVCFAH4Z08 qjjcoVjiDSxIUSuj0Dngh1WTo5LuQB3XA6AK/9P3MzCbu+HVGt9WGL37M/edJjtq2vDr tAXqm5Wotf38Vf24CdvV4NyTXKwJnCgDZi6EqBWIVZsI0+8rG2YODm1uLsE4UcaTqEeL 7SrrLz38CluwfmZwRU65Be9YOO61GwbfrBcpNxLjYG6lHqk0pb4bGrPV5ZbCmQ0akf/i 1U5p5SFA/SVIQOb+TiA0cicTuyLSptJMMSieasKQqoQJGauvubqhaxnYxjU9NfxRRYjg jqUQ== 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=YcQFtZFE8u8ptS6UxbRE8BKZ2UCRDKZbu/z+ByVfMKSkZHPfBpocXrm+kuREYWtPS9 TKiyzRwzjyIkKrLZz4ZHaKMNUbAnFX+uOcjKDZJCujOEYXHD36HzjJ4FfvmtVXyrTA/Q NvXEiD+gpsr2GyVz2T1K2wpgPbcTkNEs51cbg240aSfkj6HLrmmmX882BhOIWYVFdbAn fdO4r3X457QwUzeAAZ7dv7LfVMTSsIP/FHcxWhRgLp/+7cDn65BAC8v7mSU+uDCLJgMK Im+5sBkVvBMGzpWPYKpyO9fXCJANT8Xho+/j5ekVR75NNR/c0me55KKI45XAwu6lMNXt juIQ== X-Gm-Message-State: AOAM531TAjnOnlDUMEJwwxUTVmYrMKHU/M3a9YDc5E7I8TiTXjM0+uWw VrBGXDEjAJl5apwHAmk1ZWDRSQodGbQvt2htCA== X-Google-Smtp-Source: ABdhPJwG12ZLaDAfde6kCuzuNBgRgVAZ2cfeDTVTpsfwVYnSTyYZDI3BCmNc0oTZe2CrTCv/sza/LsBHBT7q4e3JtA== X-Received: from kaleshsingh.c.googlers.com ([fda3:e722:ac3:10:14:4d90:c0a8:2145]) (user=kaleshsingh job=sendgmr) by 2002:a0c:c284:: with SMTP id b4mr203054qvi.6.1601912444879; Mon, 05 Oct 2020 08:40:44 -0700 (PDT) Date: Mon, 5 Oct 2020 15:40:05 +0000 In-Reply-To: <20201005154017.474722-1-kaleshsingh@google.com> Message-Id: <20201005154017.474722-3-kaleshsingh@google.com> Mime-Version: 1.0 References: <20201005154017.474722-1-kaleshsingh@google.com> X-Mailer: git-send-email 2.28.0.806.g8561365e88-goog Subject: [PATCH v3 2/5] arm64: mremap speedup - Enable HAVE_MOVE_PMD From: Kalesh Singh X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201005_114048_938362_7B03C087 X-CRM114-Status: GOOD ( 18.51 ) X-Spam-Score: -6.5 (------) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-6.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:84a listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 1.2 MISSING_HEADERS Missing To: header -7.5 USER_IN_DEF_DKIM_WL From: address is in the default DKIM white-list -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.0 DKIMWL_WL_MED DKIMwl.org - Medium trust sender X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: joelaf@google.com, Mark Rutland , Gavin Shan , Brian Geffon , Peter Zijlstra , Catalin Marinas , kaleshsingh@google.com, Ram Pai , Dave Hansen , Will Deacon , lokeshgidra@google.com, linux-kselftest@vger.kernel.org, "H. Peter Anvin" , Christian Brauner , Shuah Khan , Mina Almasry , Jia He , Arnd Bergmann , "Aneesh Kumar K.V" , Masahiro Yamada , x86@kernel.org, Krzysztof Kozlowski , Jason Gunthorpe , Ingo Molnar , Sami Tolvanen , kernel-team@android.com, Hassan Naveed , Masami Hiramatsu , Ralph Campbell , Kees Cook , minchan@google.com, Zhenyu Ye , John Hubbard , Frederic Weisbecker , Mark Brown , Borislav Petkov , Thomas Gleixner , Zi Yan , surenb@google.com, linux-arm-kernel@lists.infradead.org, SeongJae Park , linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Kirill A. Shutemov" , Colin Ian King , Andrew Morton , Mike Rapoport , Sandipan Das Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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