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: 13258152 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 98CFDC77B7A for ; Mon, 29 May 2023 06:17:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 15F7F900003; Mon, 29 May 2023 02:17:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 11024900002; Mon, 29 May 2023 02:17:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F1A34900003; Mon, 29 May 2023 02:17:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id E1393900002 for ; Mon, 29 May 2023 02:17:32 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id B59BB80218 for ; Mon, 29 May 2023 06:17:32 +0000 (UTC) X-FDA: 80842285944.14.3BFB4E2 Received: from mail-yb1-f171.google.com (mail-yb1-f171.google.com [209.85.219.171]) by imf02.hostedemail.com (Postfix) with ESMTP id E180C80003 for ; Mon, 29 May 2023 06:17:30 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=PnX8u4a7; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf02.hostedemail.com: domain of hughd@google.com designates 209.85.219.171 as permitted sender) smtp.mailfrom=hughd@google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1685341050; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=QJ3N9RNUACQk0rp/xTQEOUK2bEy9LceuxJNDbuu7Hdo=; b=3uE9iN86j7Ji83ZolFP7+hQ3kld+MoVTC9h97FDQyLWZP8ZN8m+9tTj9cAqINPttRSiT7m Ln5Py34vWp8l3+cgtWtGLm5/9rSjJUPIGK04HzXgS8PubJUdUN2cO/RLRI3aFANuC254xS 8oLm4lQ99vMM0NjPNzqz2tUG6BIdpIU= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=PnX8u4a7; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf02.hostedemail.com: domain of hughd@google.com designates 209.85.219.171 as permitted sender) smtp.mailfrom=hughd@google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1685341050; a=rsa-sha256; cv=none; b=w2cd43WdBKLm2UP2/te2LpgUTyb/ZYg3aeG9BUcxHJIiHy1Q3hiGIXeRUX4mGLno5tgJTz IlpezpG7l2cTdqz7PJpTZOWnwfGOKavzY7xQngxPKt6u8JBg+oVeDEJDDYvG8YmlVEBKYK s2csrGZa6uykhuqIzIXrJ76ndb9h0JY= Received: by mail-yb1-f171.google.com with SMTP id 3f1490d57ef6-ba829e17aacso4343552276.0 for ; Sun, 28 May 2023 23:17:30 -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=GpB+yGFbnl/+ZsXzZAwu0YLzsFV4TPpi6kZugihB2GPALXTqXoojs57of1mx+QAgLw U0Xurupqz3biokWTnWdYVrJGKXgDeLF9AgtsPGR9CweMdGHQ0+Pis3RJKctdPwUYgSZP MghH5UPjF0h2LcavcjevoveWvvBjLGPtKWej+5cDKmnlD7n2K9bnuSmyN+ozcZb6JKFa SI0eFTgCteo/jEnaUtawLFAgCLuRpa46lggKYG6unWvcoQqrgV8+yDAD/wyPmDGG86k7 y3IH20OEnKXK/cO7CxPDK9HlN/4c8yOOzDFeqgHzExEK97M3QyScv/lBfVu0WyCzO/Gk XiMA== X-Gm-Message-State: AC+VfDxqyCtw0HdLp8pMDwYve/GryZvZnq/YgRvIWVhA+/Zv0+uWVwur yjuRlSrSMHV2IaXOkH4uelWZyA== X-Google-Smtp-Source: ACHHUZ6g2ncsiViAbUymnL1kKwlhN1cywz3Q5/8UINRdk6/z7ELyukBfTa2iPWzHzMx63rqo3lZAZA== 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-Rspamd-Queue-Id: E180C80003 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: h4nbkfocmcc9a78fijmhau9kokhb871r X-HE-Tag: 1685341050-563270 X-HE-Meta: U2FsdGVkX18ek8qOgE0l5SZRZGvxuyDsqjEsBnPT2CA+MdcqsLEcxZUgd65J0L9HZPYdIOG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CAlDJqeOnxgrSmMW9x7kw0+IKeGoMuKj/O/una2uHMO80MvbJI5RLYBXPNrU8WQB9u1rGYcl0c790SJKuCpRz7IlUyyXsqio4kjbf+52tDcAn+asn/Wd37QkShlfx/SYOLTRdjijuCN66lvH5VSoTLQ3hXqQ4url+HDbPxTifUwOorHtfXQ4iElof3Tu1Y+fBSqu6RetnuAYoR8mZD9rVOv8wm3nHbH+/2D55XwC/yWWKt9pxwn6yC3Ncl7bbhthN2gAu6Uc2uC1La3rCcAwQ== 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: 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);