From patchwork Thu Jul 13 09:53:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13311671 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AD7AFC001DC for ; Thu, 13 Jul 2023 09:41:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC :To:From:Reply-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=81oAh4Ljl3j6zcwXJl6F0K784HSN2nV7fdASirneLEM=; b=4nfLYWIVYk3vxO OOuRBDI8zAvz7YF49wCuR8KQhpYf+RO7K3GwiFO+q5tKIIrAhVB6beLrlp6ddk/4mjSd7E5ATpmsp quEb2HV3AqVeMzUnsfcmDrRKXzfjlHTyKMwd7N5N8vcH99Q9AT8clliupWy/vHjc1lo70jLGbLe2a a2cdvBXrbvLiYeBXXAIT5CvLo19g3DP/NGn3UYLhHPXv0yC4MlQy2LQEJrFpn058IWhUtFVBTU2kG 5wcGnlRknpF689x7hEp8ZyGiEC/x2ArLuL08lWvPU4GPFZ53i7B7h3fvvaphjeteXgb43a3wSpMha 4bNA27qjX0T3M9Kbz0Rw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qJsoL-002e6q-1w; Thu, 13 Jul 2023 09:40:33 +0000 Received: from szxga01-in.huawei.com ([45.249.212.187]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qJsoJ-002e0y-0J; Thu, 13 Jul 2023 09:40:32 +0000 Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4R1qMQ0F4fzrRnX; Thu, 13 Jul 2023 17:39:46 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Thu, 13 Jul 2023 17:40:21 +0800 From: Kefeng Wang To: , Andrew Morton , CC: Russell King , Catalin Marinas , Will Deacon , Huacai Chen , WANG Xuerui , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexander Gordeev , Gerald Schaefer , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , Sven Schnelle , Dave Hansen , Andy Lutomirski , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , , , , , , , , Kefeng Wang Subject: [PATCH rfc -next 00/10] mm: convert to generic VMA lock-based page fault Date: Thu, 13 Jul 2023 17:53:28 +0800 Message-ID: <20230713095339.189715-1-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230713_024031_294131_0813A26C X-CRM114-Status: UNSURE ( 7.75 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add a generic VMA lock-based page fault handler in mm core, and convert architectures to use it, which eliminate architectures's duplicated codes. With it, we can avoid multiple changes in architectures's code if we add new feature or bugfix. This fixes riscv missing change about commit 38b3aec8e8d2 "mm: drop per-VMA lock when returning VM_FAULT_RETRY or VM_FAULT_COMPLETED", and in the end, we enable this feature on ARM32/Loongarch too. This is based on next-20230713, only built test(no loongarch compiler, so except loongarch). Kefeng Wang (10): mm: add a generic VMA lock-based page fault handler x86: mm: use try_vma_locked_page_fault() arm64: mm: use try_vma_locked_page_fault() s390: mm: use try_vma_locked_page_fault() powerpc: mm: use try_vma_locked_page_fault() riscv: mm: use try_vma_locked_page_fault() ARM: mm: try VMA lock-based page fault handling first loongarch: mm: cleanup __do_page_fault() loongarch: mm: add access_error() helper loongarch: mm: try VMA lock-based page fault handling first arch/arm/Kconfig | 1 + arch/arm/mm/fault.c | 15 ++++++- arch/arm64/mm/fault.c | 28 +++--------- arch/loongarch/Kconfig | 1 + arch/loongarch/mm/fault.c | 92 ++++++++++++++++++++++++--------------- arch/powerpc/mm/fault.c | 54 ++++++++++------------- arch/riscv/mm/fault.c | 38 +++++++--------- arch/s390/mm/fault.c | 23 +++------- arch/x86/mm/fault.c | 39 +++++++---------- include/linux/mm.h | 28 ++++++++++++ mm/memory.c | 42 ++++++++++++++++++ 11 files changed, 206 insertions(+), 155 deletions(-)