Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp7430482rwd; Tue, 20 Jun 2023 00:49:34 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4a2tE5Pdwbgd7OPzif65eVlGRXd29UPYYXvB/f4ojfxcfZPZF9+PFmzRW7n3ufMimtzP3l X-Received: by 2002:a05:6358:e81f:b0:130:f208:9d98 with SMTP id gi31-20020a056358e81f00b00130f2089d98mr3153019rwb.11.1687247374196; Tue, 20 Jun 2023 00:49:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687247374; cv=none; d=google.com; s=arc-20160816; b=nmHyjTIn7iglW0GK/8VY59MqfXHrYuqsR6vouHRFN/mhP2IuipnmyFu1EcyW+jdUZj omm7RCtx8G3UucwQ0HzTl5IXDUaON1TomWckwtmTkv7yoyDcSj6EZZxYJS0g/XmMaoTI umF2otc+QRvEhzJU8ql+bIayk06sr5ZjLBZsnDUAnvsHi8JtFxcI23v45iojmD0CQcDv iv8dLiQUJv7/0FlAE956d0fkJKPEe0BRmygCkGRGHYzcRI8YFcB4g6qUFfNJhZ+2dqON SwASa8k5um9AQ/rePDFuVUIO7QxElYB1OBAnrC05tTpVuL4aXJqe0dGOvtRYola11Y7G 2RTQ== 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=2Xgtva00uaRjPQjQYWCbyYlUVerqtzlz4H3/JM5nRsA=; b=joIf/MgwCGGqFZ05TRaOcNjDLchJdpWCkhM1IX0w2yVy1ZgNyYu6bDjxoj2q/6+tnu kilvmdzP82V5il7namJf4ccMisJUGPki5Z2PUYSS3q0+MWJQdDpeGSgRx743CBdCUlC1 6pMTlK5j4eCgLRz8m9FwtgNpWSNfTgnpE3w60ivUw5C7PlBpo+j0VcpQOOqLa65aKzaP F/pfBou+ByFi5k7/sHZMHlJ91YIuMko+29jOXGYeCmjyKu+LoFGbfY0OC5Vdjghw1f3T Dvs2zZWKX5RnEQIeAACNp8vJ+H9IZisvF6JcuNcbCT0xG3Bz5I42RkddFNVrm4r5ueiB rX5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b="0LMD2/Bp"; 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 a27-20020aa795bb000000b0066882f939e0si1101788pfk.325.2023.06.20.00.49.21; Tue, 20 Jun 2023 00:49:34 -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="0LMD2/Bp"; 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 S229933AbjFTHlo (ORCPT + 99 others); Tue, 20 Jun 2023 03:41:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231455AbjFTHlT (ORCPT ); Tue, 20 Jun 2023 03:41:19 -0400 Received: from mail-yw1-x112f.google.com (mail-yw1-x112f.google.com [IPv6:2607:f8b0:4864:20::112f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FBB01FC6 for ; Tue, 20 Jun 2023 00:40:14 -0700 (PDT) Received: by mail-yw1-x112f.google.com with SMTP id 00721157ae682-5701e8f2b79so49562237b3.0 for ; Tue, 20 Jun 2023 00:40:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1687246813; x=1689838813; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to; bh=2Xgtva00uaRjPQjQYWCbyYlUVerqtzlz4H3/JM5nRsA=; b=0LMD2/Bp9LkZIBYgPbN4jKWx5l3xqsV5p+9EAezDq6xR/SWmyYTEAe1FdDy1xbMmRb H8PBsbrNU4fYI4mKZfhyMwB/CU4nG5b31JuXXrIAyWt0sajI0olzTibXN+ktWNYF0oep x0ccngPNp6kQepRw/XRcKOWVrIwm+WEupexqrFO6FFWjiu1SlHy8yMCBdGb2CGeJXPQe rQ6klP2gqbiJAoxVWslA7bD8MQXYp6OVctc8Pm9x7E9rZqqXloCfaCSI/DExJxOsqSJT 4d6fjthovhopd44fEKacEstPh46MmIG/u5ZNkKED0IyMDYNloqJ4rKSwMXR8oHsnZsZm /6EA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687246813; x=1689838813; 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=2Xgtva00uaRjPQjQYWCbyYlUVerqtzlz4H3/JM5nRsA=; b=M2kI2BfSxb5OwIoQs7CGagC+IMfq7sUAXO2+ptSWjiBqf7mG2H5cqREYW588Xp8vJR WsYsPTSa0uviSfKT1FQBtsltKV71LCwhiB7I/vDdt/POxFiEv8iLcPJnuwdT86vZXCcE ufWMIltFsAoyu3knUYTK2Tqbsg22/GnL/A/t24/CaiBMCXfMRUMUDuZ5fhH/+rXRsURv T10DqpRTB7WLP/+0NR3fYUmgOvTPTsgpm/kEFrMWvC8soLhYeO0vGs/gpTVV+2/1FGCZ S4PFwNcYL2oYmN0eOVOs3TSuZyprBfAnL7cNd0+EZTIAFxojs6W1VvVQ0Xb1Zv+5fggr kXnA== X-Gm-Message-State: AC+VfDzF93sSe2Y1MGcCowLw/ja39f7r4a4gkSJvaaAIoEjsuGYE5aKF luaoYWKmSHW+nrnwzUL8C3YfVg== X-Received: by 2002:a81:75d6:0:b0:56d:b98:cc16 with SMTP id q205-20020a8175d6000000b0056d0b98cc16mr13330173ywc.45.1687246813120; Tue, 20 Jun 2023 00:40: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 x8-20020a817c08000000b005623ae13106sm368166ywc.100.2023.06.20.00.40.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jun 2023 00:40:12 -0700 (PDT) Date: Tue, 20 Jun 2023 00:40:00 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@ripple.attlocal.net To: Andrew Morton cc: Gerald Shaefer , 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 01/12] mm/pgtable: add rcu_read_lock() and rcu_read_unlock()s In-Reply-To: <54cb04f-3762-987f-8294-91dafd8ebfb0@google.com> Message-ID: <53514a65-9053-1e8a-c76a-c158f8965@google.com> 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=unavailable 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 Before putting them to use (several commits later), add rcu_read_lock() to pte_offset_map(), and rcu_read_unlock() to pte_unmap(). Make this a separate commit, since it risks exposing imbalances: prior commits have fixed all the known imbalances, but we may find some have been missed. Signed-off-by: Hugh Dickins --- include/linux/pgtable.h | 4 ++-- mm/pgtable-generic.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h index a1326e61d7ee..8b0fc7fdc46f 100644 --- a/include/linux/pgtable.h +++ b/include/linux/pgtable.h @@ -99,7 +99,7 @@ static inline pte_t *pte_offset_kernel(pmd_t *pmd, unsigned long address) ((pte_t *)kmap_local_page(pmd_page(*(pmd))) + pte_index((address))) #define pte_unmap(pte) do { \ kunmap_local((pte)); \ - /* rcu_read_unlock() to be added later */ \ + rcu_read_unlock(); \ } while (0) #else static inline pte_t *__pte_map(pmd_t *pmd, unsigned long address) @@ -108,7 +108,7 @@ static inline pte_t *__pte_map(pmd_t *pmd, unsigned long address) } static inline void pte_unmap(pte_t *pte) { - /* rcu_read_unlock() to be added later */ + rcu_read_unlock(); } #endif diff --git a/mm/pgtable-generic.c b/mm/pgtable-generic.c index c7ab18a5fb77..674671835631 100644 --- a/mm/pgtable-generic.c +++ b/mm/pgtable-generic.c @@ -236,7 +236,7 @@ pte_t *__pte_offset_map(pmd_t *pmd, unsigned long addr, pmd_t *pmdvalp) { pmd_t pmdval; - /* rcu_read_lock() to be added later */ + rcu_read_lock(); pmdval = pmdp_get_lockless(pmd); if (pmdvalp) *pmdvalp = pmdval; @@ -250,7 +250,7 @@ pte_t *__pte_offset_map(pmd_t *pmd, unsigned long addr, pmd_t *pmdvalp) } return __pte_map(&pmdval, addr); nomap: - /* rcu_read_unlock() to be added later */ + rcu_read_unlock(); return NULL; } -- 2.35.3