From patchwork Tue Apr 2 07:51:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13613524 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 1BCEACD1284 for ; Tue, 2 Apr 2024 07:56:44 +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:References:In-Reply-To: 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: List-Owner; bh=L2EdB+Gg0uUXbmGJPAjShRALayEjvjGFY/EcDccQyEw=; b=bJnxVIwntqz2x7 7IsHP7xq/OXF32DsRvZL+3vaqOBUPIL8L/N9zjKxWGa1WaH5gDjGci75Lo/gx2CzUp84aDZ62k55I To0cV2p3cHYpKcpD2qHwlslAONgl5FRFuVy3aqnepaEUfvklklELEi0jsoqqRarhzOLvGv9Fdzl98 LUrKcdtIO5GPg4MvCvyi5r9V8RG3CMFrhH3UkPaWNofN6r/O6euVl5Wybyv85kt4p5k/N36ej5eGq khAJv966r1gH2LVdDMd2CWh5z0hvj9ZG0UrtIaD6UOiJj9GEWNd/RbSXxVHfwliNp7ccrIRrQeV7Q MadfUPlvyfL3d8acXSew==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rrZ0U-0000000A9X4-2Hkd; Tue, 02 Apr 2024 07:56:34 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rrZ0G-0000000A9V3-1z7j; Tue, 02 Apr 2024 07:56:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:Content-Transfer-Encoding :MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From: Sender:Reply-To:Content-ID:Content-Description; bh=3lgbc0V97n4dqVCETRztl1tx7Hvne1+ku9oZwtLMRKM=; b=a+TOAUyYYZ3N8IH+u6X5aedBdf aGKNciA2dYLw39tnm2Z0PLqDMMSKhZ0SIktmey+M4c0f0Gl/n+zsGrYZg2MRoHv6a9/g/kOlE+KAr QeD12vci9C+eesEnLz4vyq7TtQSK83esE+iEXjgx1OA3MwLanwrv1Y1YG/vq7DyRLN1a67uJRO+91 FpGlBjM48ivO9EXkEp8SRedn6U7YcapGH/EQXufims2bYa2R0UivEdT2dbBP2wnUmS92ziFmZW3wN jNvFcubuNMzuCP8sQTILpKl1Y1J4NiyYhQ5JlnrbCIiWse3kvXcm2AeCLx2Yh3TRF2tMOStKboVwU SjWRE62A==; Received: from szxga02-in.huawei.com ([45.249.212.188]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rrYyM-00000003V4G-3Hap; Tue, 02 Apr 2024 07:56:16 +0000 Received: from mail.maildlp.com (unknown [172.19.163.48]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4V80Tk2SWLzbds4; Tue, 2 Apr 2024 15:52:26 +0800 (CST) Received: from dggpemm100001.china.huawei.com (unknown [7.185.36.93]) by mail.maildlp.com (Postfix) with ESMTPS id CD95B18007B; Tue, 2 Apr 2024 15:53:20 +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; Tue, 2 Apr 2024 15:53:19 +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 6/7] s390: mm: accelerate pagefault when badaccess Date: Tue, 2 Apr 2024 15:51:41 +0800 Message-ID: <20240402075142.196265-7-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20240402075142.196265-1-wangkefeng.wang@huawei.com> References: <20240402075142.196265-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemm100001.china.huawei.com (7.185.36.93) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240402_085444_449118_68988DDB X-CRM114-Status: GOOD ( 10.22 ) 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 The vm_flags of vma already checked under per-VMA lock, if it is a bad access, directly handle error and return, there is no need to lock_mm_and_find_vma() and check vm_flags again. Signed-off-by: Kefeng Wang --- arch/s390/mm/fault.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c index c421dd44ffbe..162ca2576fd4 100644 --- a/arch/s390/mm/fault.c +++ b/arch/s390/mm/fault.c @@ -325,7 +325,8 @@ static void do_exception(struct pt_regs *regs, int access) goto lock_mmap; if (!(vma->vm_flags & access)) { vma_end_read(vma); - goto lock_mmap; + count_vm_vma_lock_event(VMA_LOCK_SUCCESS); + return handle_fault_error_nolock(regs, SEGV_ACCERR); } fault = handle_mm_fault(vma, address, flags | FAULT_FLAG_VMA_LOCK, regs); if (!(fault & (VM_FAULT_RETRY | VM_FAULT_COMPLETED)))