Message ID | 20230724094354.90817-47-zhengqi.arch@bytedance.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show
Return-Path: <linux-f2fs-devel-bounces@lists.sourceforge.net> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3A5EBC001B0 for <linux-f2fs-devel@archiver.kernel.org>; Mon, 24 Jul 2023 10:26:15 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from <linux-f2fs-devel-bounces@lists.sourceforge.net>) id 1qNslb-0000CE-GW; Mon, 24 Jul 2023 10:26:14 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from <zhengqi.arch@bytedance.com>) id 1qNsla-0000C8-4Y for linux-f2fs-devel@lists.sourceforge.net; Mon, 24 Jul 2023 10:26:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=CMESg6KcZ1f/x8j8WNeV/0Ezds9kYbd4Innm/bU0Ooo=; b=NKLzYg4+aGkUOiXzJvfw5KHqKx 6dHM+cbl3+nalFRZ0Sj67SPOmtKxPFVW8x0E3UcyL2t3vlt7KqXJlvsL2wBUQFX1GBbUYm6Yvenl7 EESFCCAhws9oWl9NO3u8FI6wi4tA6a1rysUK92V5NBImtnTczLYFEhgYiP+Q1v3kEQMQ=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=CMESg6KcZ1f/x8j8WNeV/0Ezds9kYbd4Innm/bU0Ooo=; b=bB4V0b+7A+vbl2/bliUx63WDUw UhaBg8cAZCPc/HjRwSM71pUrcByDcYPPCTa1EfUQCP4jWVoUHhx1slc7u5FpznsT7JLwXrnWWyRMc PpZMhODEp1wgheEx4SlsIB3opwJecDSpuvcP/QD6jDelUaonIKGJw7M/N928ZNaxiOCI=; Received: from mail-yb1-f179.google.com ([209.85.219.179]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.95) id 1qNslY-00059p-Dr for linux-f2fs-devel@lists.sourceforge.net; Mon, 24 Jul 2023 10:26:12 +0000 Received: by mail-yb1-f179.google.com with SMTP id 3f1490d57ef6-ca429c9dc0bso433447276.0 for <linux-f2fs-devel@lists.sourceforge.net>; Mon, 24 Jul 2023 03:26:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1690194366; x=1690799166; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CMESg6KcZ1f/x8j8WNeV/0Ezds9kYbd4Innm/bU0Ooo=; b=jHgbctg+M++LiFW1Q/x2TsKFJi1kPrf6scRf3aEqu5Y+ueGqNxxWgqcY2lULImsVJt EQx3zLm6MiLldSXMSDwkpB8HbBZ3e8uuHUILkCkc4mvzxxweYyBz/MjoePGveIh/T+Mt y6Po1fPmJHrxDwAMMI4w+82XnpEkIN9YmoT//cpM8Rs+nC0AGtiZVJllN64X9X9IZEPs jObjzMiEC95gd3BHmKrFGNVOMDhOIxZtHgFSq+anmEjjkw5JMoo7pfys/o4r+2couDWu 747PN9tOFWVSpMcxmgiPqLM82dgciEE9MJBVLHwM92bRkvhbudZqAN9Z4l40xQAs8hso jHWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690194366; x=1690799166; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CMESg6KcZ1f/x8j8WNeV/0Ezds9kYbd4Innm/bU0Ooo=; b=a7V5wUbFDG6SUjYgmAbdlXGkcT50eJvM82zQjefFtmQAeuDnZR+l9halxaXPbuncLU lzUpXWOasrMrgRAH53I+Fg02rBr3/xrb96E9/1rv8jZnPRVvxSID2KF2+zQj5ow4Oe0e afJjR64Do7ztN2v9s8aKlxtptayUOWwGupGZqhK0iUUPjf8Z/5vnRiDbHTukOzkbqhzd sm3sz8wi5Awef8A4Vr98KTX8u3ahHghEy6c7Jw2ec+DkHp2B5rqETOboNxdwLoueG4EN 5rOcPen/52hpMEF8SSVfyhJq09D03zuycUJY0yKKpn9p3uUMvI+tCO/WIX/6mcnQpUI5 egpA== X-Gm-Message-State: ABy/qLal14h3pyxUl6v8yFzqH0oLwvnnlXcruOHprDgooy7LfKu+z0SB xOs2pzOCPPjfRaWtet0+2MqjZy3H0vh0pSD9a3M= X-Google-Smtp-Source: APBJJlGXXWR+7sUNZwfELUHGku1GBmb2Z0Up/m3d12N15W4mEcGvzf3zzmR3Y2DB2osG2hV81y8tMw== X-Received: by 2002:a17:902:dacf:b0:1b8:9215:9163 with SMTP id q15-20020a170902dacf00b001b892159163mr12209813plx.6.1690192456927; Mon, 24 Jul 2023 02:54:16 -0700 (PDT) Received: from C02DW0BEMD6R.bytedance.net ([203.208.167.147]) by smtp.gmail.com with ESMTPSA id d5-20020a170902c18500b001bb20380bf2sm8467233pld.13.2023.07.24.02.54.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jul 2023 02:54:16 -0700 (PDT) To: akpm@linux-foundation.org, david@fromorbit.com, tkhai@ya.ru, vbabka@suse.cz, roman.gushchin@linux.dev, djwong@kernel.org, brauner@kernel.org, paulmck@kernel.org, tytso@mit.edu, steven.price@arm.com, cel@kernel.org, senozhatsky@chromium.org, yujie.liu@intel.com, gregkh@linuxfoundation.org, muchun.song@linux.dev Date: Mon, 24 Jul 2023 17:43:53 +0800 Message-Id: <20230724094354.90817-47-zhengqi.arch@bytedance.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: <20230724094354.90817-1-zhengqi.arch@bytedance.com> References: <20230724094354.90817-1-zhengqi.arch@bytedance.com> MIME-Version: 1.0 X-Headers-End: 1qNslY-00059p-Dr Subject: [f2fs-dev] [PATCH v2 46/47] mm: shrinker: hold write lock to reparent shrinker nr_deferred X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: <linux-f2fs-devel.lists.sourceforge.net> List-Unsubscribe: <https://lists.sourceforge.net/lists/options/linux-f2fs-devel>, <mailto:linux-f2fs-devel-request@lists.sourceforge.net?subject=unsubscribe> List-Archive: <http://sourceforge.net/mailarchive/forum.php?forum_name=linux-f2fs-devel> List-Post: <mailto:linux-f2fs-devel@lists.sourceforge.net> List-Help: <mailto:linux-f2fs-devel-request@lists.sourceforge.net?subject=help> List-Subscribe: <https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel>, <mailto:linux-f2fs-devel-request@lists.sourceforge.net?subject=subscribe> From: Qi Zheng via Linux-f2fs-devel <linux-f2fs-devel@lists.sourceforge.net> Reply-To: Qi Zheng <zhengqi.arch@bytedance.com> Cc: kvm@vger.kernel.org, dri-devel@lists.freedesktop.org, virtualization@lists.linux-foundation.org, linux-mm@kvack.org, dm-devel@redhat.com, linux-mtd@lists.infradead.org, x86@kernel.org, cluster-devel@redhat.com, xen-devel@lists.xenproject.org, linux-ext4@vger.kernel.org, linux-arm-msm@vger.kernel.org, rcu@vger.kernel.org, linux-bcache@vger.kernel.org, Qi Zheng <zhengqi.arch@bytedance.com>, linux-raid@vger.kernel.org, linux-nfs@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-erofs@lists.ozlabs.org, linux-btrfs@vger.kernel.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net |
Series |
use refcount+RCU method to implement lockless slab shrink
|
expand
|
diff --git a/mm/shrinker.c b/mm/shrinker.c index 744361afd520..90c045620fe3 100644 --- a/mm/shrinker.c +++ b/mm/shrinker.c @@ -303,7 +303,7 @@ void reparent_shrinker_deferred(struct mem_cgroup *memcg) parent = root_mem_cgroup; /* Prevent from concurrent shrinker_info expand */ - down_read(&shrinker_rwsem); + down_write(&shrinker_rwsem); for_each_node(nid) { child_info = shrinker_info_protected(memcg, nid); parent_info = shrinker_info_protected(parent, nid); @@ -316,7 +316,7 @@ void reparent_shrinker_deferred(struct mem_cgroup *memcg) } } } - up_read(&shrinker_rwsem); + up_write(&shrinker_rwsem); } #else static int shrinker_memcg_alloc(struct shrinker *shrinker)
For now, reparent_shrinker_deferred() is the only holder of read lock of shrinker_rwsem. And it already holds the global cgroup_mutex, so it will not be called in parallel. Therefore, in order to convert shrinker_rwsem to shrinker_mutex later, here we change to hold the write lock of shrinker_rwsem to reparent. Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com> --- mm/shrinker.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)