From patchwork Mon May 29 06:17:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugh Dickins X-Patchwork-Id: 100086 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1308648vqr; Sun, 28 May 2023 23:19:39 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5kcix995tGMp8+3KU3rfEBiHu4XMdfsVmxDZ/6p9zcEnkXenFj/EQruIDdVn4JNzErruR1 X-Received: by 2002:a05:6a00:194d:b0:64f:5406:d59e with SMTP id s13-20020a056a00194d00b0064f5406d59emr16221757pfk.17.1685341178903; Sun, 28 May 2023 23:19:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685341178; cv=none; d=google.com; s=arc-20160816; b=WWxg4pTBzTMxUCHvzedBGSEBx2etAu1jUaLGKf4SPaJ1scKjVpnh4KT+jcSSa7NY/E vGa4KAfp4WEclOS57l22Y7j3wLYssYC+G80Y5vgqkmWjKuuvDGYdsVsVwzvAgJ6nc89v 24ndS9DRf2d6qbf1178XLBrehQuPc8rpxKHzVB8LHkKnWTMVAO41XgNn45GPwtfDZZdZ rXtCNR2ZaqPfqjXb3SbOEzVQSGfGttZAuBXHRuUvu/rOF2B1Hg2+s2m6+xjQUy1ctvLB yuH1HUo0/oeRG2vJx9mkr1mF3BD/vdAaEZOi2jbb55A1M2+rn9QMZvzzBdiBpJVvrcSD rsjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=QJ3N9RNUACQk0rp/xTQEOUK2bEy9LceuxJNDbuu7Hdo=; b=Z+cZtgUUKXSKFMp7u2egO2sKze6fxVjGZUs/JaoN+7IQu0p4ejrGcKcL1SOPX/RElq olilS1BMv/HdIaQDB5s6+r/+9wQPvlurPMnnuiK8RrMuvGJ6kns63tX5WTrr9qqJli49 PkbMh3hM/1if4yhrBdR8VC8aJY/1K6BBjBLDdaFz2Y0Nen6aTOIdAlZqxsI9WVwAQ3ZT jxwWHC8N2blAmHMmWHYtcUl490oIm61SW5uPes4551lSbDEh/9q523tTL4wplB+7+TXW vWkVNYJX7wSFfgM+R3MdUo8rNjTU2keU/NHuxLi1rDPYcobCEye+Hk4c2e7U2U4xUDXv 5i9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=PnX8u4a7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 24-20020a631258000000b005307b843a98si8880866pgs.53.2023.05.28.23.19.27; Sun, 28 May 2023 23:19:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=PnX8u4a7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231504AbjE2GSE (ORCPT + 99 others); Mon, 29 May 2023 02:18:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231438AbjE2GR6 (ORCPT ); Mon, 29 May 2023 02:17:58 -0400 Received: from mail-yb1-xb2b.google.com (mail-yb1-xb2b.google.com [IPv6:2607:f8b0:4864:20::b2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F280211A for ; Sun, 28 May 2023 23:17:31 -0700 (PDT) Received: by mail-yb1-xb2b.google.com with SMTP id 3f1490d57ef6-ba71cd7ce7fso4322751276.1 for ; Sun, 28 May 2023 23:17:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1685341050; x=1687933050; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to; bh=QJ3N9RNUACQk0rp/xTQEOUK2bEy9LceuxJNDbuu7Hdo=; b=PnX8u4a7nFzrI9AMI1PfJ2JIEBsc/6HUoh5hn/jeCJld2cHVyPh5B3mpoBHYP4HlDt huCzuvd10XbNys3q964U8F3Pwm5I1086lfw4K2KXsSdCwoHho0iYP2E/vuoTg9TJPXAw 9Ao+OBlyjIf+ii9nemOKDnm34wjGWTWJPqiOtaDLYpgSbKG3NeKVJfh7S3pXb1pULdQN cjURL7J2sqlVPM4/ao36PpQzMPvierIr1dk2aTiiL2s04dhzXCN3987Ah17CrCgicXI7 uLzuDFZr6ZrjJPk0lh0dr69aYCwSbUbiqg2JiJfrZxUW7xsSohaWtB46bIclcU6whmCj +nDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685341050; x=1687933050; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=QJ3N9RNUACQk0rp/xTQEOUK2bEy9LceuxJNDbuu7Hdo=; b=ayc/u27ZpsiP91RHSmP2vvjmiz1I5Qy30y1tTw99/+NOSYMX6EdswNwG8RvTWZsBLQ s1LIWd0G+hfTjbs8Z99y6dGjwXu8+khyASBP+lAa7hql1wb2QoRV10tfON6fBwYYMbPI 3Lfihv+H4hoJGMljWpdHCKcBjvQ3je8qkADInNP1I30NzAxQ+hzIK4m1+RsXQPxbfUTx ubvmo8CqaQ69eDEKPVcSVDvDxa6LHmCZMNF7zdG+FB5GA61SP6S5rFtdyKTaWylTna2U VPV9SwPq8CPFTJwMCs4Fu6unDrlGFGKSMd1q2KNL3HH1tHbXhAeEF16MEkivkK08SYLv pkDw== X-Gm-Message-State: AC+VfDzUVvm9WwCa8NJkUfb7qz6ld9Tz3LjYXtgilBATWoD4fSo0X6Ta tt4hzqP8ALP7YZzB36OhyRrRmQ== X-Received: by 2002:a25:fc19:0:b0:ba1:e06b:bc57 with SMTP id v25-20020a25fc19000000b00ba1e06bbc57mr9201429ybd.64.1685341049679; Sun, 28 May 2023 23:17:29 -0700 (PDT) Received: from ripple.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id t62-20020a814641000000b0054f8b201c70sm3381110ywa.108.2023.05.28.23.17.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 May 2023 23:17:29 -0700 (PDT) Date: Sun, 28 May 2023 23:17:25 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@ripple.attlocal.net To: Andrew Morton cc: Mike Kravetz , Mike Rapoport , "Kirill A. Shutemov" , Matthew Wilcox , David Hildenbrand , Suren Baghdasaryan , Qi Zheng , Yang Shi , Mel Gorman , Peter Xu , Peter Zijlstra , Will Deacon , Yu Zhao , Alistair Popple , Ralph Campbell , Ira Weiny , Steven Price , SeongJae Park , Naoya Horiguchi , Christophe Leroy , Zack Rusin , Jason Gunthorpe , Axel Rasmussen , Anshuman Khandual , Pasha Tatashin , Miaohe Lin , Minchan Kim , Christoph Hellwig , Song Liu , Thomas Hellstrom , Russell King , "David S. Miller" , Michael Ellerman , "Aneesh Kumar K.V" , Heiko Carstens , Christian Borntraeger , Claudio Imbrenda , Alexander Gordeev , Jann Horn , linux-arm-kernel@lists.infradead.org, sparclinux@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 03/12] arm: adjust_pte() use pte_offset_map_nolock() In-Reply-To: <35e983f5-7ed3-b310-d949-9ae8b130cdab@google.com> Message-ID: <94c2ebe1-6b23-1cee-4aae-22cb835776ff@google.com> References: <35e983f5-7ed3-b310-d949-9ae8b130cdab@google.com> MIME-Version: 1.0 X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767208312402604691?= X-GMAIL-MSGID: =?utf-8?q?1767208312402604691?= Instead of pte_lockptr(), use the recently added pte_offset_map_nolock() in adjust_pte(): because it gives the not-locked ptl for precisely that pte, which the caller can then safely lock; whereas pte_lockptr() is not so tightly coupled, because it dereferences the pmd pointer again. Signed-off-by: Hugh Dickins --- arch/arm/mm/fault-armv.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/arm/mm/fault-armv.c b/arch/arm/mm/fault-armv.c index ca5302b0b7ee..7cb125497976 100644 --- a/arch/arm/mm/fault-armv.c +++ b/arch/arm/mm/fault-armv.c @@ -117,11 +117,10 @@ static int adjust_pte(struct vm_area_struct *vma, unsigned long address, * must use the nested version. This also means we need to * open-code the spin-locking. */ - pte = pte_offset_map(pmd, address); + pte = pte_offset_map_nolock(vma->vm_mm, pmd, address, &ptl); if (!pte) return 0; - ptl = pte_lockptr(vma->vm_mm, pmd); do_pte_lock(ptl); ret = do_adjust_pte(vma, address, pfn, pte);