Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp36826pxk; Wed, 30 Sep 2020 17:06:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJwHwrb4a/ShjJ1OqTrQLF3N0ystB01T2FemNENgi7Uji5O2yFhNH8D4ZlAzQIBBSiGR91 X-Received: by 2002:a17:906:e50:: with SMTP id q16mr5609329eji.544.1601510784096; Wed, 30 Sep 2020 17:06:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601510784; cv=none; d=google.com; s=arc-20160816; b=tnE4bc59hUz1CEBX6b8viBUp1pPM3LF0dEeqdE6tQ1V0Itnih+y2gMeLeHJOF5igLm wcnucV/38zksnaEVthB6mk/Ph8o2+mDb0SqTf8kCOwE1ECsYerCTiG0AENBbUUF67WDf zcmXCZkfqAwU+hCGhRPGOyh6jYK21Zfg8Z84ziGyc8wcO/3pGFIKkFa7hoIj786kJjO4 BLXGrwMku4RUijv+HdD+lF6W0N7c+BGJiTT6tyQS63ERf4Jx6nOJxjAq3q5QQ2kFAbj2 WK0JL7Fd+0UlXytefNXsg3RCaiDH6T5ecAeSTADS4YEJGxawlvk3Q3tjGYExbL4kIRhi svjw== 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=M0Jnd5wDs989jegufD80A647gOObA9k7fcoXOfGIBiI=; b=hezVd/kn4jNdnsP7ptDHGL7AtY5oXU5Mt44nB1GrD8xZSH8uulATT5zxIcnrhWKE4n kXGSC4LBpdEOcrZBSJJu333guOJqreoMg78/Gdw0qg+U6Ctoi2znLEDawmGfxjChXmwX qZgmYSYg/X0kVH/iwQUfQ9oUyM6CmQFUtq/KdtNSSk6sWsGHqCu8G7MND3yMcpBUHuBd j+vPFmngnuyc/DuMxRk9KV3hfpJSbSHGqfPCOqsLUyzRUcUxoz/ZuOm3l5r9k+adm2DJ QgtGEqmyjeIwWWgDB+LydANjNOk3lFTDrbiaQdXEX9tevlZW9nhDhsNWQcTSK3E5PWAC kKcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=boDpHG4Y; 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 gc15si2277075ejb.464.2020.09.30.17.05.42; Wed, 30 Sep 2020 17:06:24 -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=boDpHG4Y; 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 S1731462AbgI3WV6 (ORCPT + 99 others); Wed, 30 Sep 2020 18:21:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727210AbgI3WV5 (ORCPT ); Wed, 30 Sep 2020 18:21:57 -0400 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD91DC061755 for ; Wed, 30 Sep 2020 15:21:57 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id v106so3228138ybi.6 for ; Wed, 30 Sep 2020 15:21:57 -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=M0Jnd5wDs989jegufD80A647gOObA9k7fcoXOfGIBiI=; b=boDpHG4YKr/2sBYi+LXa7BYu2zahi8BWNiXF87MohJyyIman1YZgh2emp0eq+ALxVF N8Rorega2dCLqmupg5pggd4PEd0bioiDmLQNT/uayIfQYI/mK9sOXXXaXnkfAPLGDmJx /Co7dHpFXUZPb6JhgzEuOs4vsL7nB/ouZzo9v6V4300dN5vLptrbHO4vapViZXwBudAh Ek2t7vH58qT4ABFOsGeFw8dE9HSppt8Cv93fwPd7G3MmAMn3Em8oG/bsv6UWDPJ3jGbg m/Zl/8FLGMadTgwwz/0FCcE3Bg5lmumAkFDQr0+kGeF1/sPrtYOu+Lj4tH/9bYQCLPbI YrzA== 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=M0Jnd5wDs989jegufD80A647gOObA9k7fcoXOfGIBiI=; b=KsK/z+boa2fnJG/nN3KiPPNWMFK3LW1zTO9i8l7tMjsorORM9CPV7Ly/jIy5q1Po7s gse5XgQeJ0qwJubx9TK/cCmeM2YdfK0Gn07O0d2mqqdJlLHO9EeMJ3CV9MdksIAvbTys LBIh46uGI9XYP/g5EC5baV8Y1Nw2GbitTSeJF4W3xeCRclDNY+YEtMWI51qrxrl42JmS 5K7ZYCJNH2WXSN+kuwxZIYQYpOE5fVxYa/JFk7V0qN67jB4AZ8nc4vHryxuY34cvEk0F kxC/1YRiJT9ZnHfvqaocnqkAxNsmz+62VJiek9lwjqJkNrz8B4BujOC2TH0h5O7Ttz1D 1c+w== X-Gm-Message-State: AOAM533oftnTch7rCW+vdChoR69aHFPPkNywLNke/WLC1WOb828lKbvL 44/jme4fSh4/mRNlQ3eIUv0keomMNuN7cOLbdg== 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:a25:ae9f:: with SMTP id b31mr6084827ybj.437.1601504516920; Wed, 30 Sep 2020 15:21:56 -0700 (PDT) Date: Wed, 30 Sep 2020 22:21:19 +0000 In-Reply-To: <20200930222130.4175584-1-kaleshsingh@google.com> Message-Id: <20200930222130.4175584-3-kaleshsingh@google.com> Mime-Version: 1.0 References: <20200930222130.4175584-1-kaleshsingh@google.com> X-Mailer: git-send-email 2.28.0.709.gb0816b6eb0-goog Subject: [PATCH 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 , Kees Cook , "Aneesh Kumar K.V" , Peter Zijlstra , Sami Tolvanen , Arnd Bergmann , Masahiro Yamada , Krzysztof Kozlowski , Frederic Weisbecker , Hassan Naveed , Christian Brauner , Mark Rutland , Mike Rapoport , Gavin Shan , Mark Brown , Jia He , Zhenyu Ye , John Hubbard , Dave Hansen , Sandipan Das , Ralph Campbell , "Kirill A. Shutemov" , Ram Pai , Mina Almasry , Colin Ian King , Masami Hiramatsu , SeongJae Park , 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.709.gb0816b6eb0-goog