From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.5 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,MISSING_HEADERS,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3DFD3C4363C for ; Fri, 2 Oct 2020 16:21:42 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id ACF20206B5 for ; Fri, 2 Oct 2020 16:21:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="SWSITLXo" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ACF20206B5 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 427316B006C; Fri, 2 Oct 2020 12:21:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3D57A6B006E; Fri, 2 Oct 2020 12:21:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2A0816B0070; Fri, 2 Oct 2020 12:21:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0106.hostedemail.com [216.40.44.106]) by kanga.kvack.org (Postfix) with ESMTP id F1FCC6B006C for ; Fri, 2 Oct 2020 12:21:40 -0400 (EDT) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 90F2E1EE6 for ; Fri, 2 Oct 2020 16:21:40 +0000 (UTC) X-FDA: 77327501160.23.bit49_611034b271a5 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin23.hostedemail.com (Postfix) with ESMTP id 6985D3760C for ; Fri, 2 Oct 2020 16:21:40 +0000 (UTC) X-HE-Tag: bit49_611034b271a5 X-Filterd-Recvd-Size: 6494 Received: from mail-qt1-f201.google.com (mail-qt1-f201.google.com [209.85.160.201]) by imf36.hostedemail.com (Postfix) with ESMTP for ; Fri, 2 Oct 2020 16:21:39 +0000 (UTC) Received: by mail-qt1-f201.google.com with SMTP id w10so1361168qtt.23 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=BACboLw+4I0voZJXbSVJcFE503QvBygD64r9/8bSeqRE1nOc7CSOUMWR+IsmTOhq45 UMCFX2GzNyZYrwrykEFRQ447HbK2hmSgJ/Jy8b40P5HzyYS19ra6LaFwvmu/0G1Ghw/E ha4yVd1QA1TMnlVcGzUYJWqiob8eb8/4afTpsOZ50Z8momUcxyK/wPOGDznWEy0+6rXZ bwQxwPGrTwglqwmQyNqMn6DVLzhqoWtrExUyLJJA4gY0eBlPErGf2otgbbOdZZPDCAZn gyHZ3I9hRfzKbUaKvEP9Z4M+HYLLhjCwQ3wce3Rsg0G77naXg2D7LpgkKpVie2qA5S7j y9VQ== X-Gm-Message-State: AOAM530v8TNTD4wzNrXBXSvm2ck0bjF2LhfBMJV5aRDT9jUvKhW5SRYU Lz854F8zT9V+7lyeWtkEVn9rA8S47grPxkXJ4A== X-Google-Smtp-Source: ABdhPJzAcDzqBLOfrOtUkHbp2ct++BpAXy2BN0jF0742eLl9Z7QHKpd7tITMB94KYDpe2P+caZGnT+Xj149VKfshrg== 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" X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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