Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp440450pxb; Tue, 14 Sep 2021 00:35:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwWr9MkkpuGDL+F1NF+YJzsoP9BUgAj7jv8o9ArtWhX2ygHXgtTN8fjdmMel9AAjBSPsmOy X-Received: by 2002:a6b:c80f:: with SMTP id y15mr12391349iof.80.1631604900879; Tue, 14 Sep 2021 00:35:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631604900; cv=none; d=google.com; s=arc-20160816; b=SUpXofa2bpJbaRyaFiTay4ZyPjNf2FY9hfh5n2r3JbD+TgaxGFvP/tKUebnOJJIH0h vDI9bJbhJtnRoSa1IJHCg9DBc2QCVXNg/0PqROsHyolkxbkyl+P98MmJFEphXaSG/KBc thpJKyXEvx4cVnze5MC3DHWXAsklSmjeoyqt/tPq5ykXFEQKNlmYN8ufNHLRLvX3arHG 06MiOydkthpaVglqypljITyyok0EzZzGpXMi6cTrNDAjVe0sQfQF7XPbpYlXryFRaCSG r1yqICU7JVOG60xeqtxh6pUaB+tB4waZIS8U14KxQydobFWRB44k26a2NXBoY8jXzxkI cyqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=pdSMr5/T83fWycgKHeCNyglH8dIFjVjgVfZi+3aGb/o=; b=j2Oxlgbbmui3XbGNGY4bhvvb/9KF08TFn4vCvDn8SgDTz8DimJWA2++N/fxmUVqES3 GMC13lm+fuR7w3IwUXzCTEhAoaOPUKq9XJw57SVGzUOuTIVpLeA+xerB+bmppvoFC9Im 639K8HzKaheL7eCwWi/fzSrtVw4Cu5s76B4roHm1fNoP7qeVzIMTWJ0cIG1MvWEHl/rq 95SkBviw2a0CadX3mg/eTMULNlfBiTXlSw0N990VgHf3HKJOflwmYeQ1SV6psh8ibc2L ygZoNjRDdLdZe9NNfR11SZGf9+PmFiuK6TozPxbTdUiERpEFhIMM4SW1onzsPi9nXG9a i+tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20150623.gappssmtp.com header.s=20150623 header.b=lcF2FdRL; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n2si4611118ilt.29.2021.09.14.00.34.49; Tue, 14 Sep 2021 00:35:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance-com.20150623.gappssmtp.com header.s=20150623 header.b=lcF2FdRL; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240691AbhINHfJ (ORCPT + 99 others); Tue, 14 Sep 2021 03:35:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240981AbhINHey (ORCPT ); Tue, 14 Sep 2021 03:34:54 -0400 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 091BEC0613C1 for ; Tue, 14 Sep 2021 00:33:31 -0700 (PDT) Received: by mail-pl1-x636.google.com with SMTP id f21so5362054plb.4 for ; Tue, 14 Sep 2021 00:33:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pdSMr5/T83fWycgKHeCNyglH8dIFjVjgVfZi+3aGb/o=; b=lcF2FdRL9SmDj6sPoOKJRFfCDRkvqUq7bcdi+w6EjU85E25KLBbP9RZIf1g1RF1VGF dYD9vWNLARJj2aso1D0zfM0tnh4+8LLXP8x/ks1iAmoSo5bmlyG8s7Z4L6t/Hzh3kAb5 aiqgfjgCJg0JeYJHrRHvuB3Z0Z7gozQJUUV59v99TdjJn4MNtsOzrrf2X0U15bNWONQM 5+CLF53XPlAE3WN/08ilsg/S9SSdjV5YOvnjHcNrUELXww7m4qHx+z7E74VGqXqULLTE 484Bt5XKw+KSNOZ871DW0obWlvMU3XQsR/zX7L4m/X/CtmizI8nwl5rOukLwJO8Bpky4 qO2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pdSMr5/T83fWycgKHeCNyglH8dIFjVjgVfZi+3aGb/o=; b=XZPJdLW1hcHC7xoGnnNvgdQ3zQPwZSBFJxDb+IVYZWdw+r9r6ueLM+WbSm2Vv/9I7u s8t9YMSl7TQkDm7W0hLY62HcJCrvshImOtW3kUZ5esp48bUbjJGhfyGnrO4FsvsONhHq vmwaWr7sShS2UHjyp9F0rUKGGVrzHg4Gqkl75ZRT8WxiiW6L5WSuS9NDC8JqlSSNSquD MAv8ZTAyAivURyTHjCCgBJtbspHeWihmc+rW5cXrIImGxqMLP0vmoHP+sBwtaAX2RSkU 7Aq/74omJXf9badnLznWxrA7LukDwOKdKWksP1ywwqPUeRDXy76OSLJABDOP6r+HhofA o8Bw== X-Gm-Message-State: AOAM530tj1mnUTwNkBzLL1M4gBpgmQiViuxvovzDOSYcqqIDpAosue4Q yNzaPgSBHWPuHAZ1ZU60IWmnEw== X-Received: by 2002:a17:90a:1c81:: with SMTP id t1mr544287pjt.170.1631604810566; Tue, 14 Sep 2021 00:33:30 -0700 (PDT) Received: from localhost.localdomain ([139.177.225.244]) by smtp.gmail.com with ESMTPSA id s3sm9377839pfd.188.2021.09.14.00.33.24 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Sep 2021 00:33:30 -0700 (PDT) From: Muchun Song To: willy@infradead.org, akpm@linux-foundation.org, hannes@cmpxchg.org, mhocko@kernel.org, vdavydov.dev@gmail.com, shakeelb@google.com, guro@fb.com, shy828301@gmail.com, alexs@kernel.org, richard.weiyang@gmail.com, david@fromorbit.com, trond.myklebust@hammerspace.com, anna.schumaker@netapp.com Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-nfs@vger.kernel.org, zhengqi.arch@bytedance.com, duanxiongchun@bytedance.com, fam.zheng@bytedance.com, smuchun@gmail.com, Muchun Song Subject: [PATCH v3 05/76] mm: list_lru: remove holding lru lock Date: Tue, 14 Sep 2021 15:28:27 +0800 Message-Id: <20210914072938.6440-6-songmuchun@bytedance.com> X-Mailer: git-send-email 2.21.0 (Apple Git-122) In-Reply-To: <20210914072938.6440-1-songmuchun@bytedance.com> References: <20210914072938.6440-1-songmuchun@bytedance.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Since commit e5bc3af7734f ("rcu: Consolidate PREEMPT and !PREEMPT synchronize_rcu()"), the critical section of spin lock can serve as an RCU read-side critical section which already allows readers that hold nlru->lock avoid taking rcu lock. So just to remove holding lock. Signed-off-by: Muchun Song --- mm/list_lru.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/mm/list_lru.c b/mm/list_lru.c index 4962d48d4410..6b2f3cbe5f67 100644 --- a/mm/list_lru.c +++ b/mm/list_lru.c @@ -402,18 +402,7 @@ static int memcg_update_list_lru_node(struct list_lru_node *nlru, } memcpy(&new->lru, &old->lru, old_size * sizeof(void *)); - - /* - * The locking below allows readers that hold nlru->lock avoid taking - * rcu_read_lock (see list_lru_from_memcg_idx). - * - * Since list_lru_{add,del} may be called under an IRQ-safe lock, - * we have to use IRQ-safe primitives here to avoid deadlock. - */ - spin_lock_irq(&nlru->lock); rcu_assign_pointer(nlru->memcg_lrus, new); - spin_unlock_irq(&nlru->lock); - kvfree_rcu(old, rcu); return 0; } -- 2.11.0