From patchwork Wed Apr 3 08:37:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13615367 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 7E517C6FD1F for ; Wed, 3 Apr 2024 08:38:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D1FBB6B0088; Wed, 3 Apr 2024 04:38:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CB3CD6B008A; Wed, 3 Apr 2024 04:38:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B48BA6B0089; Wed, 3 Apr 2024 04:38:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 96EDA6B0087 for ; Wed, 3 Apr 2024 04:38:30 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 14D82A0AA2 for ; Wed, 3 Apr 2024 08:38:30 +0000 (UTC) X-FDA: 81967569180.29.4A6786F Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) by imf24.hostedemail.com (Postfix) with ESMTP id 3ACD9180017 for ; Wed, 3 Apr 2024 08:38:26 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf24.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.191 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=1712133507; 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=P5b4yFsYeu6RL2K1GFOSGnIl+bu0Y+v049gYqa9uHl8=; b=So4ZTgUqVzB5bOPyZs7I68TLViQm5LKuD4wFG8TkAa+XbBHYHh00Vsxg35R6yqK3UPV/3i W5Wr9VmebB9OowEcWheJyzhblCXT3HWApzsUq/13W1SIPm1C5qZqO43mSU2L1RAGbALOtk +Mn9zMQqU1DgF2dMjRIoPkwbOgNvQAE= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf24.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.191 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1712133507; a=rsa-sha256; cv=none; b=Il2oruL2Kj9HoaVuV82hnRwCho1leECc6oLshTvp7pCC8me/OvsBYH3k0ewWnr/QoW3+hj 5z4ADJYDnF8Z7vk+auyuLCywJMP1h5QXPCb9PBJLYyjP3zy45YuOn464/R5owDZFdtSlo+ 3M2R+DNL6g4x/8YlbcG10D2JpJ0pHPU= Received: from mail.maildlp.com (unknown [172.19.163.44]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4V8dP54B5kz1h5X1; Wed, 3 Apr 2024 16:35:37 +0800 (CST) Received: from dggpemm100001.china.huawei.com (unknown [7.185.36.93]) by mail.maildlp.com (Postfix) with ESMTPS id 0D7F8140410; Wed, 3 Apr 2024 16:38:23 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by dggpemm100001.china.huawei.com (7.185.36.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Wed, 3 Apr 2024 16:38:22 +0800 From: Kefeng Wang To: CC: Russell King , Catalin Marinas , Will Deacon , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexander Gordeev , Gerald Schaefer , Dave Hansen , Andy Lutomirski , Peter Zijlstra , , , , , , , , Kefeng Wang Subject: [PATCH v2 0/7] arch/mm/fault: accelerate pagefault when badaccess Date: Wed, 3 Apr 2024 16:37:58 +0800 Message-ID: <20240403083805.1818160-1-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm100001.china.huawei.com (7.185.36.93) X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 3ACD9180017 X-Stat-Signature: ec8zo3r3c58mntjub7h6yq3atmxu9ub7 X-HE-Tag: 1712133506-121220 X-HE-Meta: U2FsdGVkX18yPvO2o+2EBF1fQD24y9tW3UCWBTeK7gERi4IFbXUFsHWk8bUBRRpClQy7TUKhPByCCeBlHB6anqNblitVpjDs2F9R71PoWuHZrqzBtZw4kSUxxXUl7daKjhfqTLxuUB9XRWmsSazVNB361aOvRk13UqUJtyyYUIsUzSIc0v8OSJfN9oi49TRYCmZJEzT5o4PAqIrjRfqC2SWPEb9E9AIJzSjJCIVQMNs+bOp7RVV+bWa/HiO9aFdNrJMvdtYBp2dKge35/quJfxCRIIyBylLioTOAF0lSC3+SBGR0sBayY2hkV5FYHGFsNX6z8iknIckB0o7d4cmocUpEkRc2fI/W/UovuEP4teVJ72QeG3ibuUwU8k+L6RwH3+ZIpoBDcxTJwZ/TV39X9jSuvizCUkMlERMFbQS7XJ+wzrcOkpIdnrf0QlgMGT6yGxIiem0VwY/JsIXv9oY7gsvV6K3L4m/2Mok4xllNptvpJbu1KfmRxzVCPAamftO5ZXndbKd1OtLLfFvYfEm8R0Ffi1knwc4ZNUD71eLWUD8VW5gAR8S5712lamaVoUrrbhXwVExBPBm9d94XrR2pFbYTyA5QMF7oTrPERd4WEb8/HI0O/5XT+0p0geldslNW54wQjEihsmslwk037yh9dwBvsMpv19jrChu39hAXCGLgE2/zo4oc/FGcDR/v6B90MMZ2vlDxAMZiKYBBW6j8MaMc04fKduGAwY5oow+AGIZ9vbv0lXzAcXf+9JSgxonYhS6GbGmluUx0Cl9+5Kkuwts+Jh4p8Kuu3s8S6iws7XP3qUTt8FWLKZ/+1p/Ecz6T4xWbH8FrJp+o13Oy4IUdKxy/usVcKsqpHPbb+7RpY/0F3+ynOYjBlipz1vr9PruGmIKmaOnQTwrE2iSYYx8NbhhrmcDRCtYqDPgKIL/9pERXTu3EUypXiXDeFcCs56MaPKki0QsncQCMWLIu9qi VIpmgrbr NtPQniPlEr2G8RCT2XG18cBF7hTP7BSZpU8KSIZXdhy75ioah98rgFEXD+QVAmusLzvxZBQDBNt9pTYHjH1jn/qRmzoCB7/hkjOejYVuRdWYN25TRPvHMt6UPgQ== 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: List-Subscribe: List-Unsubscribe: After VMA lock-based page fault handling enabled, if bad access met under per-vma lock, it will fallback to mmap_lock-based handling, so it leads to unnessary mmap lock and vma find again. A test from lmbench shows 34% improve after this changes on arm64, lat_sig -P 1 prot lat_sig 0.29194 -> 0.19198 Only build test on other archs except arm64. v2: - a better changelog, and describe the counting changes, suggested by Suren Baghdasaryan - add RB Kefeng Wang (7): arm64: mm: cleanup __do_page_fault() arm64: mm: accelerate pagefault when VM_FAULT_BADACCESS arm: mm: accelerate pagefault when VM_FAULT_BADACCESS powerpc: mm: accelerate pagefault when badaccess riscv: mm: accelerate pagefault when badaccess s390: mm: accelerate pagefault when badaccess x86: mm: accelerate pagefault when badaccess arch/arm/mm/fault.c | 4 +++- arch/arm64/mm/fault.c | 31 ++++++++++--------------------- arch/powerpc/mm/fault.c | 33 ++++++++++++++++++++------------- arch/riscv/mm/fault.c | 5 ++++- arch/s390/mm/fault.c | 3 ++- arch/x86/mm/fault.c | 23 ++++++++++++++--------- 6 files changed, 53 insertions(+), 46 deletions(-)