From patchwork Wed Jul 12 04:33:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugh Dickins X-Patchwork-Id: 13309560 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 86A8DEB64D9 for ; Wed, 12 Jul 2023 04:33:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 090F76B0072; Wed, 12 Jul 2023 00:33:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 01A556B0075; Wed, 12 Jul 2023 00:33:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DFFB16B0078; Wed, 12 Jul 2023 00:33:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id D0E306B0072 for ; Wed, 12 Jul 2023 00:33:16 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id A41F51A04F7 for ; Wed, 12 Jul 2023 04:33:16 +0000 (UTC) X-FDA: 81001690392.30.243B524 Received: from mail-yb1-f180.google.com (mail-yb1-f180.google.com [209.85.219.180]) by imf26.hostedemail.com (Postfix) with ESMTP id CD5D5140019 for ; Wed, 12 Jul 2023 04:33:14 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=oKpaowvQ; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf26.hostedemail.com: domain of hughd@google.com designates 209.85.219.180 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=1689136394; 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=i4tZyi+HkQEhA143ao3Iyv04H3IotisFVwIb+XMQSnyFpZ7o35tQtCIjzh+bj5dHSSuDI7 ktl/1SxlEyLfCknpL3e/TE3xlQXTX3DkNG6lP5MaHa/NxyqnSuT0UkxmZ+cKvM4yynT6k2 giaNVBr98QJ4MYbDfyCYpMSVkpVWYY4= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=oKpaowvQ; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf26.hostedemail.com: domain of hughd@google.com designates 209.85.219.180 as permitted sender) smtp.mailfrom=hughd@google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689136394; a=rsa-sha256; cv=none; b=dxAuob10j4w0WMCGj/XYBfB0y5NslsP5amG7nSam5CMUFpPOCg6kRpRqQp9Nkwn0i8EHez uVfj8YKV2dDOokSPExhsxIo2E/aVOJA6Rt3hh/OyZTZcSBD3Eki/I1spunw7f+NRiC5CvG 5f4OR/08iIbfwRqNmwlDvS87+uYDzwk= Received: by mail-yb1-f180.google.com with SMTP id 3f1490d57ef6-bff89873d34so5778063276.2 for ; Tue, 11 Jul 2023 21:33:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1689136394; x=1691728394; 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=oKpaowvQeaQUncOOMCvTBHmXQ/FtZl+zZp5+Fo04CzoCy9LRKSCy43wNQCF2w2abHG jYi2GRVb9SUA+cOJwBdOtClSXiZ2Z7OrQDz8b0C3ZKWCpyBSxxh9g0MDPDTlwWm1wpni MQq6dZQMaat5mVW33VG/Z/sJCOzOtM5JcugYkrHF0OjaZarDla2EabzCECYeLkptPTFA kvVOAdnkA+dARAIwQYkZ5QFG5BKKdFwsILzvRn8L6hIPQtsvNfCEpljLsKMHiBJ7Tb9i vvB9S1uM8vmPWQ9MN4Bos/RgNtKXVdLVIPeeQrun3EY+oUKy7MowWj11CHLrlgzQNYzJ ikwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689136394; x=1691728394; 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=Twi+v7jCUf1S6I68hLyAcdutgJmRglAwAsnnnYReRqWt4yhX6JpTKXWDyAQ415swFz 8nS+Njw4GpukpYpYM+uMI8X5Ti04Q1UnrdOYD+KjI+TkGBmrQfQRXPgZ27mb+Y3lOdwY CjNLJg2/hKQkYmOaaztoN4QwmwK58h/oVAw9h26cVBkPrxW/9itColp+5nQzzeXJ43zb MlG/T/YcMcMVq4sqWcMQq8SyiHP9VoqsBgc+Ljn9000VCM+BZobBLJns8x4uaIOto4xL mnku8zH2nPsgo1dMrKmvysHf+V2jwDz5vX4LIuxq5v+4ShdSQFzNqFbnPNQW6TZRawxs zl5g== X-Gm-Message-State: ABy/qLbUJVpbc9BCNYy8czYp4TshowybgFGHNrgsLrqk+5d1X9RUysII FNdGSiFmiLtNSnOv1qnbisK2ow== X-Google-Smtp-Source: APBJJlHtqAOgfTEvtz6FEYsO4J7wfUGe8UB05ARnUaznX7yxHAtr1BNRbw9aWEHw4YhpidgoA6BFwQ== X-Received: by 2002:a5b:70d:0:b0:c01:308a:44f2 with SMTP id g13-20020a5b070d000000b00c01308a44f2mr13992957ybq.57.1689136393735; Tue, 11 Jul 2023 21:33:13 -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 b8-20020a252e48000000b00c61af359b15sm751502ybn.43.2023.07.11.21.33.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jul 2023 21:33:13 -0700 (PDT) Date: Tue, 11 Jul 2023 21:33:08 -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 , Lorenzo Stoakes , Huang Ying , 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 , Gerald Schaefer , Vasily Gorbik , Jann Horn , Vishal Moola , Vlastimil Babka , Zi Yan , 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 v3 03/13] arm: adjust_pte() use pte_offset_map_nolock() In-Reply-To: <7cd843a9-aa80-14f-5eb2-33427363c20@google.com> Message-ID: <4d5258bd-ffa0-018-253a-25f2c9b783f7@google.com> References: <7cd843a9-aa80-14f-5eb2-33427363c20@google.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: CD5D5140019 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: jubk65jwq9ye7p39czsuaohnosf1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2F+FWRzsyiU0RpndKgT70TrhUlV4aGPTJvFv/BlNnl50x4Z7wMEsqaMLP3KC44E76zY+l4Mg1k/HAN490JPNpIPxqQFsbS0jMZ1zw05aJTIAO9BRlOVACvj7wcGpbLTYo2muZ4b+Hs92v+eLT0o9QXMkDh7afrWmG7fdwMlmJYLJRwonIqFbu7OHNdInNadEwKnlrd2ZeMjQ6u2CvhSkj+F4xTVHAgKYwyK5UXmOWQPvXXTWrw6iPk0efWld+yJ8IiIj7hSHtIBpq+C5q03CMASa++v3TRRkOLzGT3k9hQvGLtWJU+uTPEF9BAnuZA3418JtsMFh67zCihq1WfqSK9Au9L1kPn7bQBW2qmTaI7DV6Ip73n2XPiCtD7NCUtWZc4gv5JAGvX2RSlIV+esyok7la1AiylrmQJqTKx67wqDF0YVIffHrq+/P4bIm2aHretjhV6DFih8AKf 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);