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: 13311658 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0573EC001DC for ; Thu, 13 Jul 2023 09:40:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8B0D88D0002; Thu, 13 Jul 2023 05:40:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 860348D0001; Thu, 13 Jul 2023 05:40:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 74F2D8D0002; Thu, 13 Jul 2023 05:40:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 671198D0001 for ; Thu, 13 Jul 2023 05:40:30 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 2FE6112019E for ; Thu, 13 Jul 2023 09:40:30 +0000 (UTC) X-FDA: 81006093420.16.1281B02 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf08.hostedemail.com (Postfix) with ESMTP id B006E160006 for ; Thu, 13 Jul 2023 09:40:27 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf08.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1689241228; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references; bh=4hPYFkrmMTHxBkFKlhTqbOnZu0He74lwauxRAi4N1N0=; b=mFEzLFOrgHscmphYapgywlCk1SDFcTKVZHE0Edfl3K/aLZ1E5nQj1krScThPCOBq2lEo6X 4MuFJTRxFqnSQ9aAVOvbWn2uP6U4GPGM7eo4PLduvTJgN0LTr9HP84gaR43saUM80uZDc6 kbFvaXXOQqgjst3oWNYhKdoIULwlq4s= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf08.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689241228; a=rsa-sha256; cv=none; b=Q5lJyFQ1sEvU4/MWy4CHNv+eQ4cKbcTlyJgv8lLWo+TmDSxaPZ0unS5LssrpgcAf0Htu5S yP6jBn4hTlac/MrXEfUxL9uvKvgF6freZ7n3DCN/Vi967OXPGGRImr+zHQeeTuTvs8PauA +XSW8DxWnjv3oIsmTZB103TbSlyzNIM= 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-Rspamd-Queue-Id: B006E160006 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: w7q1fc6bf9pyojjtwqifzn196hcc1qkw X-HE-Tag: 1689241227-999738 X-HE-Meta: U2FsdGVkX180ASbhwDeSolfHVrSPd2jY9XHoGs1RAA9w29tKP7mtUAmoGqlGnKe2GTztCIN6CMFMbKZb6VmFASLonHa/sqtp70C6mhqiC8hMqPqGoCpshKv0Ot/zvZ/SqWMq6UUXietaBjaWHtRvrIKw2o/SiVVLB6aJoQL3NkvHq49fn8b+U5flOjlZbZejwKUV9g+xfEQr6ju17mI+Zp+O2RzY1Mx6F55vGS7ixZ2Y/UcUQbG667BwB5CC72jgk+TivwAaAvdrbuY/I55yi0kLMpAAv4X8zhA2O3Gs9Lyr3n7sgr1/3WEyQ12guCXq6CTcOOan8j6Hw2Ya2Bezwq4f5RIFIiaQ0R3+5NmD4leBoRYKCCYRD/MdKCe9F93jQ4KPYDa6yNi1kAZCnDFRYuiDhnhtb6chrNksEsGoSoa/6TgllHS0pEqAmPEhv4bnn6eePpaJ/n0c5dtwxBIyZTppjPpEumQ9t/+ZnV8LEs8sBSxpvPJluBoa+pRgiZA2fP8IMouf0bOCWncAXXNFhfovjTy3QPXsgCHd6Z7xJAnZz2y4yIRLZfWFazKWd2dGzKVQQIUqe9aiVURFXTb3LZ6FHn0yV/Y/G0rayzF67dOWsHsWNLKhxMwqiFygU/fNICcz/VgE6ze2ST+awpPw8vCtkdwSU5nnT7XjZGc4U1J/fK5TrDC0FPMX9OkrvwvIsFB1iKNHLfRw0bHOcywPOJvmIN5r1jefnbE2lHpVctBc6NGv6d5Rt5siplqXi2k86/TQYmgvADSMdCrfJjZ2dadfWqR484tBCHe4+BZpCPaUTQwKiGK8IVGZIgDx0g4GWxm7nnpzmvWhwsWjIRWscWG2rz2Q/r51ZCxjQ833Yr42OSzgdPI8AuEJcDntnZiZRXEpNulXkUIbOm5b1DnJ+GjWlEleHekTMlnwYmDiiXwokqBBq7nMBqjsbKGGZZ6oGhM8d0vVKjylPvTjHrL YjGTB9In 7F9mzb7EcJE6jQR2Rxo0cN9krT8vepO5CuC56FShuHDp4eJX6fEaTEdJb/mNKZtR8ONawua3ZjPLVwETXnaZmAiqpIEU5ylSz2YLckD31fg+5xdCUvJ4Ccwgmvg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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(-)