Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp7431616rwd; Tue, 20 Jun 2023 00:50:59 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5UaA9n2TFTOetTSQ+v6NINa37tkwbBjZcz8+nwbMh5GGqbdQTBL9AFHio4lAiM1YLXdHO+ X-Received: by 2002:a05:6a00:23c6:b0:668:79c4:a65a with SMTP id g6-20020a056a0023c600b0066879c4a65amr4079860pfc.32.1687247459051; Tue, 20 Jun 2023 00:50:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687247459; cv=none; d=google.com; s=arc-20160816; b=iwNjxazzUa2izBZjn/NrAMpsjiWOaOj1g7afKqUW0eISjDxY8hieDmaHq4F7g90Jqz 0Z39N7VvGNHBjMw2UHx/kUJoFCFe8BN07ns3bnLm3ZUVFOgc3OW2lS42LzHgWIpa6zDb rLY5vI71jHDlWQQRIBF3gI15HhXi+BeD8qVfG6KP4tRwC/AfN6sUGXfXnmOlsrPhiXh8 mF4O0EWVvooSZh2kB+gybzoHWcTX0MFKBL9x1MAvf3e0gqtBRv/R6wekzJYATdHuwbnD qGE+ds4v7odsTgNbcgWoUQbWlmv6oQESRaitWqsdCBOf7JeLz2gaGn6WNWpnUijmni2M WYuQ== 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=N+xkdOGkKMlcPjIB18Tl+4zu+jviglA02VIpwIIz/7TEQm/M6IwpBtQBxogUXPxD/p IU+9ADydXvg0XPqemiibJqbz9OlYOlxMwnp6MNm/rGekZlL2zPEJu1h1fAPhEY9C5B1m qLZ0VKONZqCewvtKyLQCJCLdqbrq9q9OAqz0nstGNhqrG+w7nMB0QpICOSQcxZzRHJh0 5Z+2uGRCbtR2bNZXxxkH5ClJtEPghXm/pETUlyq0DdhrvxjsHSgXkU58MQy8EdMN57cs qVG5zb30yA9s/K6rt/f4i5KYIdCJok7O7C5TcsmGVVCLPfo1xvzFMjPdQ8zSBNmZ7mk2 RRtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=qhwhngGU; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k29-20020aa7999d000000b006639d667fecsi1182390pfh.64.2023.06.20.00.50.46; Tue, 20 Jun 2023 00:50:59 -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=qhwhngGU; 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 S230088AbjFTHpG (ORCPT + 99 others); Tue, 20 Jun 2023 03:45:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231228AbjFTHoP (ORCPT ); Tue, 20 Jun 2023 03:44:15 -0400 Received: from mail-yw1-x112c.google.com (mail-yw1-x112c.google.com [IPv6:2607:f8b0:4864:20::112c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 355A3172C for ; Tue, 20 Jun 2023 00:43:56 -0700 (PDT) Received: by mail-yw1-x112c.google.com with SMTP id 00721157ae682-570808d8ddeso41703117b3.0 for ; Tue, 20 Jun 2023 00:43:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1687247035; x=1689839035; 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=qhwhngGUpgrcZDlnvH+b7VWG9WLTHUEVswW9xK/3YCFZXun6Sku2aj+qmeuJtlpDm9 NL1p7tRRaSaVuFlEgJZSd1u9Osk9e4zYWPVYSmjFqeH51Two+LdeRyVK6tn3qt9RQ2/C FXROYrneK++r2OPYxjNpEmp15a3hsycB8EeXDTwBWnGuwYFgeqd19dhMRsM+70lw7kZD UxM84oMlRLUMCqnzuOHx9Iap0algo8Gh2vtX9lFjHG25G0LFiMapQLFR33NHeN7LFjU7 xqRJD57e/d0/xxEOFNXoz5t1uVw5lEYV2V7WrZMTJMmAFZ9r11+4uO5ZNp31jPHEHE3P 8GXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687247035; x=1689839035; 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=PB2T5XpBUn6kjSmaYO7ODj/PTkbdEULQ4i/JivI6M6wDUJuYODvg+oyT8OaurwZGmu NG6kM/MqusMHX151eDHK8rFcnsA4V2oGw8Bq/168LINh/PXnwk42Fx43k+IIYBuVpgvC iYPU/iTGCDTFdTpT+pUdPWValM57whegyjn9kUd11zHkpGcuDdKMzVRA13I3KCuUEsU+ 6npyWci7WZHr4dqKDktsCKrsujdAcIYw4QiGYvRhoFuYYI/3prMYQSUxfaZCa/efYLAt PNRJI6pn5mC287hzUL6fzIS36XyhO8bLn5UHi24iI6MqR73cRZqa3rzTmkl72yYnQ3Py chLQ== X-Gm-Message-State: AC+VfDxGGHW2Uj3sGEwmmUVz8t8WJ/iUGQ9f/IGPRAF8H9coFuTM+a9b 1v/6BjnDG+Tsnbqw0prfI++ueg== X-Received: by 2002:a0d:cf82:0:b0:56d:2b1e:3d88 with SMTP id r124-20020a0dcf82000000b0056d2b1e3d88mr11408597ywd.24.1687247035289; Tue, 20 Jun 2023 00:43:55 -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 y188-20020a8188c5000000b00545a08184f8sm365085ywf.136.2023.06.20.00.43.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jun 2023 00:43:54 -0700 (PDT) Date: Tue, 20 Jun 2023 00:43:50 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@ripple.attlocal.net To: Andrew Morton cc: Gerald Schaefer , Vasily Gorbik , 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 , Jann Horn , Vishal Moola , Vlastimil Babka , 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 v2 03/12] arm: adjust_pte() use pte_offset_map_nolock() In-Reply-To: <54cb04f-3762-987f-8294-91dafd8ebfb0@google.com> Message-ID: References: <54cb04f-3762-987f-8294-91dafd8ebfb0@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII 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 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); -- 2.35.3