From patchwork Wed Sep 30 22:21:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kalesh Singh X-Patchwork-Id: 11810399 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 DBE75112C for ; Wed, 30 Sep 2020 22:21: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 A87EA20719 for ; Wed, 30 Sep 2020 22:21: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="DL8VYfES"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="FInMstcR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A87EA20719 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:Mime-Version:Message-Id:Date:Reply-To: To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=VUVTQs1AUt5EGMgSEADFp8drVtRaNVIMVUK0pT/pT8w=; b=DL8VYfESra5SE/ZgOVdUiDP1VW wZ854wE5r8oJgOhQfQq/SrCQj+wRWmlP5jJZXkcv3OHSQZlyzm+pTTZubgxVCci45KQUADwtM+YMM mBXuL7t24Slhx4z+xyGkYXe1eDcXBk9ALNExo+wijaLyeMq97WaDRGQTFOTbobliBvlgUxKrp5vui +SlojkpZrnpezacKqbsh4NGKE+hS/fPN/YTspaYumStNkNV59GJWFDE/xjB/WieCHFPMhm6jUlYd0 CkOfRTsdc/Hg8309s/84TaLbgdZKBMQfoEfjjucnaqpFR640bA9cblLL7phxMaKZhqg2lS5TBvYJ9 J0OeIwog==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kNkTk-00065v-Sw; Wed, 30 Sep 2020 22:21:40 +0000 Received: from mail-qk1-x74a.google.com ([2607:f8b0:4864:20::74a]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kNkTi-00064S-To for linux-arm-kernel@lists.infradead.org; Wed, 30 Sep 2020 22:21:39 +0000 Received: by mail-qk1-x74a.google.com with SMTP id o28so1836803qkm.23 for ; Wed, 30 Sep 2020 15:21:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:message-id:mime-version:subject:from:cc; bh=5nGapf7xO2rZTSaxGiPwPbuengbwYhe3dVDIYorRiWY=; b=FInMstcRCnnn+Uwb4uVZz2nOr0YsNe2fsrv2kqony8tTtnivnPNz7vNuxsLLqKt2WJ 7XPavd/j9HHPjLjnosmvSIix+mb0vxh/gY4VKOfM8P8BR8OMeGSrUC/wTxKidQ8pCTQe Sm7OTzOhdOAtg3DByPpqY0zvTUI2i3YrSnjdfbSWuxmila0sOR5kl1pQLE8zY7NSNTpz HI+IRGKji9bQMdE+BJ07zmdSj7CKbTJZNkaSuSc5xIClV3PCsYA+RxKm6B1yH8mYzXli V/Odoyc22NVRZmUoSt07JUBp3CPreD9H8XzC7mXd4FeYw5zZmotd3fbx/viALT0egfZB 71qQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:message-id:mime-version:subject:from :cc; bh=5nGapf7xO2rZTSaxGiPwPbuengbwYhe3dVDIYorRiWY=; b=XzG7QmgABLWpZlSyQz60w+134+iSSqmu90TkPw2Noy1jFGs1j5li91jstkA5rUqubc UGP6CUTt67Orhn/thC2YmJIo0QZ0ybknWR3F4C6Y9/MohnRNdfCbnvbtU++QFSOltq7c QlcHB1mv4YsPbZH4b2t0ntjYkM3e4W2numiktGFb+kyQ8iEIrkLW2BNv+LCAt2H2omXb CQcJC2CiBgZX3r8HN90ITKGwGZok9p9/6b8CEg45XM6U3vzYUm+wSQsTV+LlJ9/4IU0P BxA08NtIOWEnAznjrT3qzDShjF+nBBWgNTVoFNusImrAxrOBATbFIgcmyzO1lCKIUYb4 A6Tg== X-Gm-Message-State: AOAM532qQmxd4aWuV9MsKwS+OPYGPMV7Ppq6gmY6j2IU60PpZLwdGdIn rcXdhA3uIis/qkF5/oXzRnMs8FOP6iaXur+cZQ== X-Google-Smtp-Source: ABdhPJwMH+jLJIkmc9uf9QzQWk3mmJCatGwOYHysyGXnujsIvGHjAJ+hKWsevgMRuqUWSCI/u7YMo7gHIuj/AdeMGA== X-Received: from kaleshsingh.c.googlers.com ([fda3:e722:ac3:10:14:4d90:c0a8:2145]) (user=kaleshsingh job=sendgmr) by 2002:a0c:d443:: with SMTP id r3mr4849305qvh.20.1601504494642; Wed, 30 Sep 2020 15:21:34 -0700 (PDT) Date: Wed, 30 Sep 2020 22:21:17 +0000 Message-Id: <20200930222130.4175584-1-kaleshsingh@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.28.0.709.gb0816b6eb0-goog Subject: [PATCH 0/5] Speed up mremap on large regions From: Kalesh Singh X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200930_182138_976050_1B01F09E X-CRM114-Status: GOOD ( 14.92 ) 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:74a 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 , Kamalesh Babulal , linux-mm@kvack.org, William Kucharski , 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 , Borislav Petkov , Thomas Gleixner , surenb@google.com, linux-arm-kernel@lists.infradead.org, SeongJae Park , Dave Hansen , linux-kernel@vger.kernel.org, "Kirill A. Shutemov" , 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 mremap time can be optimized by moving entries at the PMD/PUD level if the source and destination addresses are PMD/PUD-aligned and PMD/PUD-sized. Enable moving at the PMD and PUD levels on arm64 and x86. Other architectures where this type of move is supported and known to be safe can also opt-in to these optimizations by enabling HAVE_MOVE_PMD and HAVE_MOVE_PUD. Observed Performance Improvements for remapping a PUD-aligned 1GB-sized region on x86 and arm64: - HAVE_MOVE_PMD is already enabled on x86 : N/A - Enabling HAVE_MOVE_PUD on x86 : ~13x speed up - Enabling HAVE_MOVE_PMD on arm64 : ~ 8x speed up - Enabling HAVE_MOVE_PUD on arm64 : ~19x speed up Altogether, HAVE_MOVE_PMD and HAVE_MOVE_PUD give a total of ~150x speed up on arm64. Kalesh Singh (5): kselftests: vm: Add mremap tests arm64: mremap speedup - Enable HAVE_MOVE_PMD mm: Speedup mremap on 1GB or larger regions arm64: mremap speedup - Enable HAVE_MOVE_PUD x86: mremap speedup - Enable HAVE_MOVE_PUD arch/Kconfig | 7 + arch/arm64/Kconfig | 2 + arch/arm64/include/asm/pgtable.h | 1 + arch/x86/Kconfig | 1 + mm/mremap.c | 211 +++++++++++++++++--- tools/testing/selftests/vm/.gitignore | 1 + tools/testing/selftests/vm/Makefile | 1 + tools/testing/selftests/vm/mremap_test.c | 243 +++++++++++++++++++++++ tools/testing/selftests/vm/run_vmtests | 11 + 9 files changed, 448 insertions(+), 30 deletions(-) create mode 100644 tools/testing/selftests/vm/mremap_test.c