From patchwork Wed Apr 3 08:38:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13615373 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 14A2FCD1294 for ; Wed, 3 Apr 2024 08:38:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 494BA6B0093; Wed, 3 Apr 2024 04:38:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3F7FA6B0095; Wed, 3 Apr 2024 04:38:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 29A356B0098; Wed, 3 Apr 2024 04:38:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 003AD6B0095 for ; Wed, 3 Apr 2024 04:38:33 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 86D72120DA8 for ; Wed, 3 Apr 2024 08:38:33 +0000 (UTC) X-FDA: 81967569306.08.802809A Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by imf16.hostedemail.com (Postfix) with ESMTP id 5BCDF18001B for ; Wed, 3 Apr 2024 08:38:30 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=none; spf=pass (imf16.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.190 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1712133511; a=rsa-sha256; cv=none; b=Tl8qn3u5H5cL6V3n7ntDUrNos0mwxofFJoggUs14D1HIItk1/imHYr1hvHeIxIFo5KcNyF lcpV+benSgKKpdcS9CScoifFG2USu8Gg0dJ6eG33SUR7gINjt1lqolbDjw1pBXZRPjMpOS jKjsjHyLB7kFeqI6EOmFVBaqOiEdNV4= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=none; spf=pass (imf16.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.190 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1712133511; 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:in-reply-to:references:references; bh=7HHcWzzE9AwVcj9rXnePyGty9Nb+tULGuXwsa1lDWyA=; b=vHA5GeWvkyN+RT/2TKIRpuQfPw6OgBTuA5HqUHeCJz1uczn+GWddWrGuUu3h/9nDOcmGYv pDRFfDmYa+uIBydNKYm6Ke2QDjzpJBqZhvthBuXzpJXphfGLPuG0v4O5C2vUrX2loSZTvc H3AJaixnByo2t3wtGLEQpmgw2L4GM8A= Received: from mail.maildlp.com (unknown [172.19.88.163]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4V8dPB65yQz29lXY; Wed, 3 Apr 2024 16:35:42 +0800 (CST) Received: from dggpemm100001.china.huawei.com (unknown [7.185.36.93]) by mail.maildlp.com (Postfix) with ESMTPS id 7BC4E180063; Wed, 3 Apr 2024 16:38:28 +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:27 +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 6/7] s390: mm: accelerate pagefault when badaccess Date: Wed, 3 Apr 2024 16:38:04 +0800 Message-ID: <20240403083805.1818160-7-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20240403083805.1818160-1-wangkefeng.wang@huawei.com> References: <20240403083805.1818160-1-wangkefeng.wang@huawei.com> 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: rspam06 X-Rspamd-Queue-Id: 5BCDF18001B X-Stat-Signature: u7n4pczymobq78ht3oocuensg749xa6y X-HE-Tag: 1712133510-326071 X-HE-Meta: U2FsdGVkX1+D7AycTcBrg8elZkQQuCNJ18VsmQa6MDT+0MOBDPIcv4OW7sGZ3+VrOkJOiq3fKiiTgWiyMuOKl0cXPCmcLNrhZ6mrjVMxVtGkHr6tonJTsGVtdPsi8jXdVDt6f51Fb/doh2WBP6mFIOAidFosehbyBRXna0dPd7cLHjlfioJMWqHKQrxF/x8gYlka/mF30Prb5pJyXrxLpOrCyeif8iM4Rew9yGQFHDm9zDhwtfdkceh+C1w8zgyiua99Laeqt8r8xnlF7C33SP2HA4DCH7nuD0t6hKvytYwQqZWF13CfEUYtopMZcwb9pjHTvdbHwXg46pr9pxDk2jAgJrHpsJfFuY7Zm+WlvlekvZ/H6lhj85oYp6xwIWm7jiwEfv1AGdYnWp7mkBXSx0kEQddb8pBoo03huAattQGv+1IVCxFTlptxwH2IggA4lvGIei+RwTRp1t8C+3ZbeUifJUyNZthw5Pirv4lMctGphNEAFPSgVU+avIZyGAT8weJqdzrjmF6eCoGaea333sOShqu3k6vazZO9VTyUpMrYEtyaMc2hh/jQ5arU6pX6RoMcXKm6ZVSIDMs+6WZMvMuxOwpS38+9wF4X57aQFyCE856JrTOtiohBRzFkor+ZxFB08kuHGu7mqtNHc2TnL9Nc/DPt+O0rvMzi0/9fXaQw2mXxgJQLX0bSBPJ38KU29nIxxiahGfUvBK2OcsnjSfE60dtWr0AmNwsrX6i5/Dc2yVttli7tA72bhKhe0B27FGjr6PG0he9UglxHgByeMDYVzP3sQg/ix25fncXdeCuTMVK1XZt0BvnyQtHN/Pi74heCNjYuzsKEtA2L+vqd9wQi/P25w8Xhp/eyteZjXg8oNDeyd2DeoixPNPLNt3m1PWImB/1h2BcaLgBVPU4REDeeyYaGIy/3hgceVsbGSiyW4ESM+kK7jR+8CbumE/TK+LArnV++3PfM5UBVTzz W9O9+I9r SAYx+zZKiZwVkKAHWVGCpJdUXFdr2sHlXrDheWuLAa6A1rEtFW4oA5OcIkDTyUkNzzwsuykjWz/S878ryHxpNatODZcTeJSL7ssASX8H5QXg5vCvmF6GG0rNCwtIEkB65oNFeIvaT5J70zwT9Ir8lCExTo2wCBcoxeyWHNm/IA2CliGI= 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: The vm_flags of vma already checked under per-VMA lock, if it is a bad access, directly handle error, no need to retry with mmap_lock again. Since the page faut is handled under per-VMA lock, count it as a vma lock event with VMA_LOCK_SUCCESS. Signed-off-by: Kefeng Wang Reviewed-by: Heiko Carstens --- 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)))