Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3399393pxk; Mon, 5 Oct 2020 08:43:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyCXbVeelHakvpv0W02ixpy3dr0aiAvUC7qXHT6s/DEdarv6hwqNQVQzJEWu3e9aalmNUQt X-Received: by 2002:a05:6402:1fb:: with SMTP id i27mr194236edy.379.1601912608690; Mon, 05 Oct 2020 08:43:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601912608; cv=none; d=google.com; s=arc-20160816; b=I/5UxcGJxU9kR3TOlrsDtcPohSX7Z/31vbsS6Jj/StqCtdnVjgLXqHMOZQITrbN0mu LG8O4fushihRG1FUT8UT2EJTyZp5BBAWQWedfBjzyWbsJcJEnF97I+XFa/+VDk3m1WiA dtP0ii1GMKmX4eci9oc/mLQOOy+a8goQvD2XP6YFNUZXWsz9nEBlgpz9AyR2OSTgwJL0 Hj79aP6UDuw27X/w6PxAkFA74Aa93MoPof+CegYQK9YvLxQob9rSXW38wpxiQYj70QC/ PX/GB1IniA7+Li4mkX2lDFXGi9VgjK0ciLRdPz+60BkDHdf0bZnemj/b21BCYJoy2Hu1 +8FQ== 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=lOEQQp6FtlaPWySCJ8UleXvQesviICtWl0F1/1pEkBp93nrI+189za/1fcy1dyIv2v 2LL4ONNPRL46GCQQbMviOc5s+xOFVHctQcdbCEpSaxGtKfe9QlmCTaVqwV/YkqYNpH3U mDQgR5kSRIkxOjj+/sXypM27ZauxbcshUHQAWZyH6lOIIrrvjvQh9+cFhccalUFTEwMt Anir2+rOni5Jb1qovogf6UICtkWq01Bn8mfNqjbgIUzpsdw+6GHUxKGjkduNt0wOkoAc bjbbf/ImKWRmer6m8KY6m35hRHTJ1RQPNxTwC5ZfMRl/88lE47Q5Q5hSE8OFIWeADBmF FhYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=G05LJGMS; 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 f9si1206ejl.32.2020.10.05.08.43.05; Mon, 05 Oct 2020 08:43:28 -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=G05LJGMS; 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 S1728780AbgJEPkz (ORCPT + 99 others); Mon, 5 Oct 2020 11:40:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728284AbgJEPkq (ORCPT ); Mon, 5 Oct 2020 11:40:46 -0400 Received: from mail-qt1-x849.google.com (mail-qt1-x849.google.com [IPv6:2607:f8b0:4864:20::849]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB49CC0613A7 for ; Mon, 5 Oct 2020 08:40:45 -0700 (PDT) Received: by mail-qt1-x849.google.com with SMTP id f5so6738771qtk.11 for ; Mon, 05 Oct 2020 08:40:45 -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=r5YDxr+gRPY7bKCnu01F/gWnDCtSQtPg5L7f53ZtHU1G+FdkqnNx84EZy/3+VldXM0 nYxkxKW7S7g75Zwp3dbyewcyXAUmtLDNiIFme7ozlekhsY+SKodT5pWXO5qNiu42hwXc dkc0o4NhbZ4jey7ggAo80umaCI63kJFPgS83MSV7O9jv0fU5x99FlyuIOe4eQFVgxu5K OxWghdaHRwEwndMxjRPi++qX6L0KoD6n2GRRBBbkymoHpm7H3QWe+V0nIbTD1h+mKvo4 phnH8+xPLeqQq0z0X/oPiZ+GlBeTyHhanvhgz4tQZKk2AzFQCjwi1QaD5YbO5tuw2+g3 +kHA== X-Gm-Message-State: AOAM530yVlsuSs+jfqRFMUVAfOgamPXDJx5CSEeYIYE3Mhih9n+8x0OI LWzSbSPkfTCa6rm1maWlhKcq9XKSD+TU9n9tYQ== 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: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 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 , Mark Rutland , Mark Brown , Mike Rapoport , Gavin Shan , Zhenyu Ye , Jia He , John Hubbard , Colin Ian King , Ram Pai , Dave Hansen , Mina Almasry , Ralph Campbell , "Kirill A. Shutemov" , Sandipan Das , Zi Yan , Brian Geffon , Masami Hiramatsu , Jason Gunthorpe , SeongJae Park , 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