From patchwork Wed Sep 30 22:21:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kalesh Singh X-Patchwork-Id: 11810411 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 536B4112C for ; Wed, 30 Sep 2020 22:22:15 +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 16AF42075F for ; Wed, 30 Sep 2020 22:22:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="orFWCMT9"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="boDpHG4Y" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 16AF42075F 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=d2hEfCZg5hD5TB2/kKWMybFCCWqvJ2ake0IL3FKW3O4=; b=orFWCMT9c4qfzeu6GbkkBPHXO n0KgubKojtWtJkkT8TAOsEMxZ/QxeWZUe0Pewgd+oEBTaed2cQ/ZWAyPorw8bxOiiF9kQCCs/vpW2 58ISkL+nHwTNH228GDibZlM7OMU6Wug6aE7Vx8D6D9h0dUGx40mv50BEgMq4g/45X/E/Y1S2/gEIC CmXHcLOqDI8K29jDEC5HUaDs1cia42yIj279hbs9QeGTyDBx9imtUo3ofo7oVsSpgY5iQnaGpGaji 77hhFnelWaAK0vvtdo6tFy7jw8XcJDiF4IYBaTPXdpuL9rWgjS1BcVY0mlq4yQVJfYchCnss57cNK /Cw8HdkLQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kNkU8-0006DQ-6s; Wed, 30 Sep 2020 22:22:04 +0000 Received: from mail-yb1-xb49.google.com ([2607:f8b0:4864:20::b49]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kNkU5-0006AW-NY for linux-arm-kernel@lists.infradead.org; Wed, 30 Sep 2020 22:22:02 +0000 Received: by mail-yb1-xb49.google.com with SMTP id b8so3212638yba.10 for ; Wed, 30 Sep 2020 15:21:58 -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=mmv7I4hc0MZjvkrbutONRU8yN5XoFhj9jajYW1BYUxHrukelYjgpV/SyMlIXgTZpbL E80UWjCTI+SdIMAyKN+VdF8pTgdnhyaTW6pBQrYGOr8SpZis4XaXscicwd27ialLz4WG qZRBFlcjUj3XP7GQBS2u/3bXTtQQ+iKtFa0gEG6BOP3zITF18WbaQ13OZucVjbZshOR+ diGdAmZo/XeIHynWLIN1AQrcxQsKi1iR3iJuUQN5+nwm4uhx7sCKxRYM2igMMqY2o3Pn zgfPU8BVR01H/gJNx8TrE08g94XOSCO6JzWtfId1T4nbJrucMhMRXm2XJ2Vx3O4eTgTy kIhA== X-Gm-Message-State: AOAM530z2snOJeAWL/U+OUGfy8q5WSOCcFbHI63cnEHQ9mHY5+PnK7M4 GSWVfk5bN8GyTJKZhjGNPWSfXf2NgyKbZbF8TA== X-Google-Smtp-Source: ABdhPJzpG054ym1h9s82GZx0gEkFQHO8lOnhV52qK7oqfRRBlQ4XabfPxVWgnQguS08M76s/iC40L0YtMGRjB+Vw+Q== 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200930_182201_842580_8790E116 X-CRM114-Status: GOOD ( 18.00 ) X-Spam-Score: -7.0 (-------) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-7.0 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:b49 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -7.5 USER_IN_DEF_DKIM_WL From: address is in the default DKIM white-list -0.0 SPF_PASS SPF: sender matches SPF record 1.2 MISSING_HEADERS Missing To: header 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -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.5 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 , 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 , 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