From patchwork Thu Jul 13 09:53:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13311712 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 A84C7EB64DD for ; Thu, 13 Jul 2023 09:59:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 266D28D0002; Thu, 13 Jul 2023 05:59:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 217658D0001; Thu, 13 Jul 2023 05:59:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 106508D0002; Thu, 13 Jul 2023 05:59:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 012B48D0001 for ; Thu, 13 Jul 2023 05:59:04 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id BD45FAFB94 for ; Thu, 13 Jul 2023 09:59:04 +0000 (UTC) X-FDA: 81006140208.11.DD55307 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf23.hostedemail.com (Postfix) with ESMTP id 625E014000B for ; Thu, 13 Jul 2023 09:58:59 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=none; spf=pass (imf23.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.187 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=1689242342; 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=PgqE83exuykN0WeeFpdKu52slDj3sRyE7QOTEX+Z6zU=; b=sXYXB+jcnH/hs5KA/V5ydlSzLKDZrAZj541Rck6FeHDV3KPZcSPGX1Q/gmkrIYEwZfA8hv hb7LZI8vJoZuFdk0HievD/g4T9cDgTqsnwF2aH/MSC6H1APN2tgmSGodYyXwNmXGmuELew jRZXLGMCfLkIz+1MlvMHHy8LcdB1pVY= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689242342; a=rsa-sha256; cv=none; b=K7cDSRgJmniXotpJmRXIpUWYaTw4aOnIwQED8T5gRio3NKYby7MyQZcPmtcFfmSR7YgGr/ o+nw4rI8/8XW8yp6RSP1Vs57MZS+V74g8T47V93Y8gXNuIjxZx2yWRDqRswR0K1WuyBMIg VDQxLWBsrY2fjgM3DjVbfnohFpU0flY= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=none; spf=pass (imf23.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4R1qJl1fsnztRTt; Thu, 13 Jul 2023 17:37:27 +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:26 +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 04/10] s390: mm: use try_vma_locked_page_fault() Date: Thu, 13 Jul 2023 17:53:32 +0800 Message-ID: <20230713095339.189715-5-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230713095339.189715-1-wangkefeng.wang@huawei.com> References: <20230713095339.189715-1-wangkefeng.wang@huawei.com> 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: 625E014000B X-Rspam-User: X-Stat-Signature: abic1uuu9b3oaptgbhz14j513z44w1kb X-Rspamd-Server: rspam03 X-HE-Tag: 1689242339-920951 X-HE-Meta: U2FsdGVkX18CJDsnX6mOArTBUfUGL5e2kdWDkR1SNg3BfjfdKXG4uskWWXVFg3kWKdNR2txis7EZ9vgP8T+zD4nF4+yD/pC6NZvms4q4jmr4OaMuRug8YdhDxBnO62t5oe0XxplUYZcUhAqXoWEOXMY+3J/euDVK+UwRrVYlIPlhINnP9UwFr0g6A3TNcSgmoZu2+vnYY6BHgAOcjNNj+2C/FhrILitQIY3sXFIxTSN5kLFl5CXmtey15inXu2PZ/4ie0CbvDK/5K9WhrI2fC3t6meDnqyIt83Rm7o0xFUVZCgFaz0eUv0AvxvQh5WeFZvbMckruQv9iyocPSRXuabYAUcmoIhxn8GF56j/EbWRsVHJ6yRDj6K2UcTMwna7KRRXDyEeZoEfZIog56H+B8gVMo4TCJFBVVAg66nLLodMDbbgFKirE0bE61KjTjz0MnXO3RzCNPyOk/xdQUmMdHbOcKE+Mt1MxXwa9Ahy8sEyn81FrgYTL+EjwxggM6byvxdPrBEmzo8UCPMpWWqNQZmgSxzteYWTPXO7Fje4bLI7/MSfAYZJMX/oiohSUeFFGTa+Fb3IE5ViFNH3x9ssUg4xAq6iAYqeK3TIgnnxkpT2I8Z/tcX0BjjpjVBCeiTdke4jcgiGLylwoYBABVj1n/Sprt9phAuZRFwaivd/dzNS0FEqUYQqK2/gkY0aBtigWt4/UBNLnyJ73RBWv0b3Iu9JuL4YAb73/E3IG43mFNykklPjm9aIelDs/eJfRnJ+7MxTlzhnMCXQoyB5kqzjsAvPlAfY5xPrSaAMjd7sLzR4RR5WLbIW/hqZWd4OTo6VYhlysZ+ZCsxibKQiFe4Wb0lbGCn65sbMenPD8Qp/dzrTnfflqEOFupXn8Wfs1J4Uv78CgHwUg4oxmzyyE3uhmqrND8jw9i3vmctXwQJXznORzh+ACridzMg1b2GTBIuegBHM/ygrXY4DAIh3v5/a j1AMHTz1 ClCxe5+H+tLm7w16BKHPT6IkYmf0eF7AveOga6rlfeVLOaEgPq/lSoFjqimHXXQDH/eqJemgKcx7L29g6XDtW4w4BDwvaP5UtbTiQnZgwrfku8gulfYpHCDd/7+XJTT/owP5DSdGq3Gif+Ml8TR19CSAJ9mfD126XJxVkF3/sClYfu2uGQ72UbFW2z8o7noSnW6tb 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: Use new try_vma_locked_page_fault() helper to simplify code. No functional change intended. Signed-off-by: Kefeng Wang --- arch/s390/mm/fault.c | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c index 40a71063949b..97e511690352 100644 --- a/arch/s390/mm/fault.c +++ b/arch/s390/mm/fault.c @@ -362,6 +362,7 @@ static inline vm_fault_t do_exception(struct pt_regs *regs, int access) struct task_struct *tsk; struct mm_struct *mm; struct vm_area_struct *vma; + struct vm_locked_fault vmlf; enum fault_type type; unsigned long address; unsigned int flags; @@ -407,31 +408,19 @@ static inline vm_fault_t do_exception(struct pt_regs *regs, int access) access = VM_WRITE; if (access == VM_WRITE) flags |= FAULT_FLAG_WRITE; -#ifdef CONFIG_PER_VMA_LOCK - if (!(flags & FAULT_FLAG_USER)) - goto lock_mmap; - vma = lock_vma_under_rcu(mm, address); - if (!vma) - goto lock_mmap; - if (!(vma->vm_flags & access)) { - vma_end_read(vma); + + VM_LOCKED_FAULT_INIT(vmlf, mm, address, flags, access, regs, 0); + if (try_vma_locked_page_fault(&vmlf, &fault)) goto lock_mmap; - } - fault = handle_mm_fault(vma, address, flags | FAULT_FLAG_VMA_LOCK, regs); - if (!(fault & (VM_FAULT_RETRY | VM_FAULT_COMPLETED))) - vma_end_read(vma); - if (!(fault & VM_FAULT_RETRY)) { - count_vm_vma_lock_event(VMA_LOCK_SUCCESS); + else if (!(fault | VM_FAULT_RETRY)) goto out; - } - count_vm_vma_lock_event(VMA_LOCK_RETRY); + /* Quick path to respond to signals */ if (fault_signal_pending(fault, regs)) { fault = VM_FAULT_SIGNAL; goto out; } lock_mmap: -#endif /* CONFIG_PER_VMA_LOCK */ mmap_read_lock(mm); gmap = NULL;