Message ID | 20231130194023.4102148-3-nphamcs@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp637384vqy; Thu, 30 Nov 2023 11:40:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IGncLrGcs64ox1K1DRsokaNjyIs0TDiLjoChaRzZFUwJskvc9UCRnZTMfhMVUOcwoeqW1Cq X-Received: by 2002:a05:6a20:2447:b0:18c:23b0:3b0e with SMTP id t7-20020a056a20244700b0018c23b03b0emr22999356pzc.21.1701373236475; Thu, 30 Nov 2023 11:40:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701373236; cv=none; d=google.com; s=arc-20160816; b=mj+z3M/qia++OLer/ZtyG/tFs6eWLQ6gg23WEA0dYEtbgYyeUGJbGYwMOl3LJbTS/n wL5CD5b4hrLE3KFoQGAzphcNalH1Dck1VHM8WWJ6j/2R98WgtowDtTxEE9O6UaiM5kgk KlbPWvKIjrJ6A1HClFSRfl4YfRkGAzgXeErbi3/qfiGEz6uTqvxHNKzzhDwSGw6dsoiO PWcYC6ifIWlObawses3+Es/g8xpfOqo/ptSevFoDUAuCsxyyTPaf0uJND5w8EbYjyMSO SUhOxYfMzIMZPBBv/1HRIRlMfl2pbtf5SCo7Og1tREtBFMYKm1YFh/hidQLufs+p/eQc fXkQ== 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=wu5h2uK3efWNzQSn40V3SLhhxDZPSFSFXXaEbLeDNVU=; fh=5ynFD2G6LA0fdRuAOSZxbBxHoIIG4U3xrwbnkupZs28=; b=hAYJ8CM6n9whontKXvvvLbZ/hce7qiDVDXEYd/kpPMX7rhQw+i+wiUmPby6E/tTawb d2ZEHwchuXACpO888CLzYiXoXL0pKlET+mKghecAS/pK3xAwdiOaxX21BShVPc7TjbdR pExdlIj7DWZQn+g0uWFAWFRFRyI6atmY7ICVeKqCHaBfNPbVSMfNLdLSJ8t7gLogUaul lPYsiZYB9HNP6Hgkcmqcq5ysroylKOuh5OvTc0fC5c7/VZxX2cV5yqZycfyju+58vthp edkWO73hQ5yvrbn5IGbJg4MsQ/ACL8rgdozHTAlF/z3csmEDH1oJS7zkjDXmHhATPobN 7xFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=YmkUr7hK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id m18-20020a056a00081200b006c3077a3400si1921454pfk.279.2023.11.30.11.40.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 11:40:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=YmkUr7hK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 6B4FA80ACB42; Thu, 30 Nov 2023 11:40:35 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376537AbjK3TkV (ORCPT <rfc822;ruipengqi7@gmail.com> + 99 others); Thu, 30 Nov 2023 14:40:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376533AbjK3TkU (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 30 Nov 2023 14:40:20 -0500 Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B73493; Thu, 30 Nov 2023 11:40:26 -0800 (PST) Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-6cde4aeea29so1115887b3a.2; Thu, 30 Nov 2023 11:40:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701373226; x=1701978026; darn=vger.kernel.org; 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=wu5h2uK3efWNzQSn40V3SLhhxDZPSFSFXXaEbLeDNVU=; b=YmkUr7hK8s3vKG4KyUdq9tGqrt46SJDxlPgYzC+2ms5s2fZF9FWemm9CzMAtnpLXoj mSwp9VE+vdUXycehX5skKznJpO4laRlGBOqbinPTZsvLNUFu1yZc8wF8kAyk9Bq1yZrQ TTxItInlzYR8UYV+FX+RC9ocTSt0pFzhotTI8ZS83uyATDdcGciJf0AdBHshk/IVqltY OqbE2S87hUTyTkc5Rhldg47vOrr+wC0geKef0VY2nL0d8hLTGR2y3HeCJ3RcZliugPPt 9hXbqRZGekh90PpyRYLwNk2Z/kHzUq+ocpF5wshETJXuxACdGRkb0S6f0mSZdQPWyw6Z yCtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701373226; x=1701978026; 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=wu5h2uK3efWNzQSn40V3SLhhxDZPSFSFXXaEbLeDNVU=; b=mar4BOaKoN/HTjRRQqjI1q+81QdsCvVk1FBWDZ/vx0ue44OxKyiVDgZFA/3A6YtwcR 4XxV+X+2hn2xijht/8psoHN5XGSwAq6WI6OGUomBOydGG5JKxG3nwXTMMC0VE5JHX7r/ sr0UcCq41U1xCbfR0r/qJGB4NPKDYEThSsGlSmOLJkQrjCxH4MOkScMXKhvhsuekEYEW NWece3HhA66MOj/ggmeNa+D6z1hOOmUUnXChxffhFJz3DCe50F2fnL/4eHh7aySgvj0p eJ5/MpsXEut7I2IMaD7w0IVAJ+V0moXsr1nkSbpqBizCifombBiKxX4wmd74+xPoxIsh cDYw== X-Gm-Message-State: AOJu0Yz0QLF0WL7Zu7dAkpB20JT6LBAmULUUCoiIX3eseay2p5oNP1LR q+4b0Hq/cSAJVk5DldG3od0= X-Received: by 2002:a05:6a00:1894:b0:6cd:eb43:f1cd with SMTP id x20-20020a056a00189400b006cdeb43f1cdmr2816622pfh.9.1701373225625; Thu, 30 Nov 2023 11:40:25 -0800 (PST) Received: from localhost (fwdproxy-prn-005.fbsv.net. [2a03:2880:ff:5::face:b00c]) by smtp.gmail.com with ESMTPSA id g2-20020aa78742000000b006cda62f118bsm1593501pfo.60.2023.11.30.11.40.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 11:40:25 -0800 (PST) From: Nhat Pham <nphamcs@gmail.com> To: akpm@linux-foundation.org Cc: hannes@cmpxchg.org, cerasuolodomenico@gmail.com, yosryahmed@google.com, sjenning@redhat.com, ddstreet@ieee.org, vitaly.wool@konsulko.com, mhocko@kernel.org, roman.gushchin@linux.dev, shakeelb@google.com, muchun.song@linux.dev, chrisl@kernel.org, linux-mm@kvack.org, kernel-team@meta.com, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org, shuah@kernel.org Subject: [PATCH v8 2/6] memcontrol: implement mem_cgroup_tryget_online() Date: Thu, 30 Nov 2023 11:40:19 -0800 Message-Id: <20231130194023.4102148-3-nphamcs@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231130194023.4102148-1-nphamcs@gmail.com> References: <20231130194023.4102148-1-nphamcs@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 30 Nov 2023 11:40:35 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784019142969494585 X-GMAIL-MSGID: 1784019142969494585 |
Series |
workload-specific and memory pressure-driven zswap writeback
|
|
Commit Message
Nhat Pham
Nov. 30, 2023, 7:40 p.m. UTC
This patch implements a helper function that try to get a reference to
an memcg's css, as well as checking if it is online. This new function
is almost exactly the same as the existing mem_cgroup_tryget(), except
for the onlineness check. In the !CONFIG_MEMCG case, it always returns
true, analogous to mem_cgroup_tryget(). This is useful for e.g to the
new zswap writeback scheme, where we need to select the next online
memcg as a candidate for the global limit reclaim.
Signed-off-by: Nhat Pham <nphamcs@gmail.com>
---
include/linux/memcontrol.h | 10 ++++++++++
1 file changed, 10 insertions(+)
Comments
Hi Nhat, Very minor nitpick. This patch can fold with the later patch that uses it. That makes the review easier, no need to cross reference different patches. It will also make it harder to introduce API that nobody uses. Chris On Thu, Nov 30, 2023 at 11:40 AM Nhat Pham <nphamcs@gmail.com> wrote: > > This patch implements a helper function that try to get a reference to > an memcg's css, as well as checking if it is online. This new function > is almost exactly the same as the existing mem_cgroup_tryget(), except > for the onlineness check. In the !CONFIG_MEMCG case, it always returns > true, analogous to mem_cgroup_tryget(). This is useful for e.g to the > new zswap writeback scheme, where we need to select the next online > memcg as a candidate for the global limit reclaim. Very minor nitpick. This patch can fold with the later patch that uses it. That makes the review easier, no need to cross reference different patches. It will also make it harder to introduce API that nobody uses. Chris > > Signed-off-by: Nhat Pham <nphamcs@gmail.com> > --- > include/linux/memcontrol.h | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h > index 7bdcf3020d7a..2bd7d14ace78 100644 > --- a/include/linux/memcontrol.h > +++ b/include/linux/memcontrol.h > @@ -821,6 +821,11 @@ static inline bool mem_cgroup_tryget(struct mem_cgroup *memcg) > return !memcg || css_tryget(&memcg->css); > } > > +static inline bool mem_cgroup_tryget_online(struct mem_cgroup *memcg) > +{ > + return !memcg || css_tryget_online(&memcg->css); > +} > + > static inline void mem_cgroup_put(struct mem_cgroup *memcg) > { > if (memcg) > @@ -1349,6 +1354,11 @@ static inline bool mem_cgroup_tryget(struct mem_cgroup *memcg) > return true; > } > > +static inline bool mem_cgroup_tryget_online(struct mem_cgroup *memcg) > +{ > + return true; > +} > + > static inline void mem_cgroup_put(struct mem_cgroup *memcg) > { > } > -- > 2.34.1 >
On Mon, Dec 4, 2023 at 4:36 PM Chris Li <chrisl@kernel.org> wrote: > > Hi Nhat, > > Very minor nitpick. This patch can fold with the later patch that uses > it. That makes the review easier, no need to cross reference different > patches. It will also make it harder to introduce API that nobody > uses. > > Chris > > On Thu, Nov 30, 2023 at 11:40 AM Nhat Pham <nphamcs@gmail.com> wrote: > > > > This patch implements a helper function that try to get a reference to > > an memcg's css, as well as checking if it is online. This new function > > is almost exactly the same as the existing mem_cgroup_tryget(), except > > for the onlineness check. In the !CONFIG_MEMCG case, it always returns > > true, analogous to mem_cgroup_tryget(). This is useful for e.g to the > > new zswap writeback scheme, where we need to select the next online > > memcg as a candidate for the global limit reclaim. > > Very minor nitpick. This patch can fold with the later patch that uses > it. That makes the review easier, no need to cross reference different > patches. It will also make it harder to introduce API that nobody > uses. I don't have a strong preference one way or the other :) Probably not worth the churn tho. > > Chris > > > > > Signed-off-by: Nhat Pham <nphamcs@gmail.com> > > --- > > include/linux/memcontrol.h | 10 ++++++++++ > > 1 file changed, 10 insertions(+) > > > > diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h > > index 7bdcf3020d7a..2bd7d14ace78 100644 > > --- a/include/linux/memcontrol.h > > +++ b/include/linux/memcontrol.h > > @@ -821,6 +821,11 @@ static inline bool mem_cgroup_tryget(struct mem_cgroup *memcg) > > return !memcg || css_tryget(&memcg->css); > > } > > > > +static inline bool mem_cgroup_tryget_online(struct mem_cgroup *memcg) > > +{ > > + return !memcg || css_tryget_online(&memcg->css); > > +} > > + > > static inline void mem_cgroup_put(struct mem_cgroup *memcg) > > { > > if (memcg) > > @@ -1349,6 +1354,11 @@ static inline bool mem_cgroup_tryget(struct mem_cgroup *memcg) > > return true; > > } > > > > +static inline bool mem_cgroup_tryget_online(struct mem_cgroup *memcg) > > +{ > > + return true; > > +} > > + > > static inline void mem_cgroup_put(struct mem_cgroup *memcg) > > { > > } > > -- > > 2.34.1 > >
On Thu, Nov 30, 2023 at 11:40 AM Nhat Pham <nphamcs@gmail.com> wrote: > > This patch implements a helper function that try to get a reference to > an memcg's css, as well as checking if it is online. This new function > is almost exactly the same as the existing mem_cgroup_tryget(), except > for the onlineness check. In the !CONFIG_MEMCG case, it always returns > true, analogous to mem_cgroup_tryget(). This is useful for e.g to the > new zswap writeback scheme, where we need to select the next online > memcg as a candidate for the global limit reclaim. > > Signed-off-by: Nhat Pham <nphamcs@gmail.com> Reviewed-by: Yosry Ahmed <yosryahmed@google.com> > --- > include/linux/memcontrol.h | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h > index 7bdcf3020d7a..2bd7d14ace78 100644 > --- a/include/linux/memcontrol.h > +++ b/include/linux/memcontrol.h > @@ -821,6 +821,11 @@ static inline bool mem_cgroup_tryget(struct mem_cgroup *memcg) > return !memcg || css_tryget(&memcg->css); > } > > +static inline bool mem_cgroup_tryget_online(struct mem_cgroup *memcg) > +{ > + return !memcg || css_tryget_online(&memcg->css); > +} > + > static inline void mem_cgroup_put(struct mem_cgroup *memcg) > { > if (memcg) > @@ -1349,6 +1354,11 @@ static inline bool mem_cgroup_tryget(struct mem_cgroup *memcg) > return true; > } > > +static inline bool mem_cgroup_tryget_online(struct mem_cgroup *memcg) > +{ > + return true; > +} > + > static inline void mem_cgroup_put(struct mem_cgroup *memcg) > { > } > -- > 2.34.1
On Tue, Dec 5, 2023 at 10:03 AM Yosry Ahmed <yosryahmed@google.com> wrote: > > On Thu, Nov 30, 2023 at 11:40 AM Nhat Pham <nphamcs@gmail.com> wrote: > > > > This patch implements a helper function that try to get a reference to > > an memcg's css, as well as checking if it is online. This new function > > is almost exactly the same as the existing mem_cgroup_tryget(), except > > for the onlineness check. In the !CONFIG_MEMCG case, it always returns > > true, analogous to mem_cgroup_tryget(). This is useful for e.g to the > > new zswap writeback scheme, where we need to select the next online > > memcg as a candidate for the global limit reclaim. > > > > Signed-off-by: Nhat Pham <nphamcs@gmail.com> > > Reviewed-by: Yosry Ahmed <yosryahmed@google.com> Thanks for the review, Yosry :) Really appreciate the effort and your comments so far. > > > --- > > include/linux/memcontrol.h | 10 ++++++++++ > > 1 file changed, 10 insertions(+) > > > > diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h > > index 7bdcf3020d7a..2bd7d14ace78 100644 > > --- a/include/linux/memcontrol.h > > +++ b/include/linux/memcontrol.h > > @@ -821,6 +821,11 @@ static inline bool mem_cgroup_tryget(struct mem_cgroup *memcg) > > return !memcg || css_tryget(&memcg->css); > > } > > > > +static inline bool mem_cgroup_tryget_online(struct mem_cgroup *memcg) > > +{ > > + return !memcg || css_tryget_online(&memcg->css); > > +} > > + > > static inline void mem_cgroup_put(struct mem_cgroup *memcg) > > { > > if (memcg) > > @@ -1349,6 +1354,11 @@ static inline bool mem_cgroup_tryget(struct mem_cgroup *memcg) > > return true; > > } > > > > +static inline bool mem_cgroup_tryget_online(struct mem_cgroup *memcg) > > +{ > > + return true; > > +} > > + > > static inline void mem_cgroup_put(struct mem_cgroup *memcg) > > { > > } > > -- > > 2.34.1
On Mon, Dec 4, 2023 at 5:39 PM Nhat Pham <nphamcs@gmail.com> wrote: > > > > memcg as a candidate for the global limit reclaim. > > > > Very minor nitpick. This patch can fold with the later patch that uses > > it. That makes the review easier, no need to cross reference different > > patches. It will also make it harder to introduce API that nobody > > uses. > > I don't have a strong preference one way or the other :) Probably not > worth the churn tho. Squashing a patch is very easy. If you are refreshing a new series, it is worthwhile to do it. I notice on the other thread Yosry pointed out you did not use the function "mem_cgroup_tryget_online" in patch 3, that is exactly the situation my suggestion is trying to prevent. If you don't have a strong preference, it sounds like you should squash it. Chris > > > > > Chris > > > > > > > > Signed-off-by: Nhat Pham <nphamcs@gmail.com> > > > --- > > > include/linux/memcontrol.h | 10 ++++++++++ > > > 1 file changed, 10 insertions(+) > > > > > > diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h > > > index 7bdcf3020d7a..2bd7d14ace78 100644 > > > --- a/include/linux/memcontrol.h > > > +++ b/include/linux/memcontrol.h > > > @@ -821,6 +821,11 @@ static inline bool mem_cgroup_tryget(struct mem_cgroup *memcg) > > > return !memcg || css_tryget(&memcg->css); > > > } > > > > > > +static inline bool mem_cgroup_tryget_online(struct mem_cgroup *memcg) > > > +{ > > > + return !memcg || css_tryget_online(&memcg->css); > > > +} > > > + > > > static inline void mem_cgroup_put(struct mem_cgroup *memcg) > > > { > > > if (memcg) > > > @@ -1349,6 +1354,11 @@ static inline bool mem_cgroup_tryget(struct mem_cgroup *memcg) > > > return true; > > > } > > > > > > +static inline bool mem_cgroup_tryget_online(struct mem_cgroup *memcg) > > > +{ > > > + return true; > > > +} > > > + > > > static inline void mem_cgroup_put(struct mem_cgroup *memcg) > > > { > > > } > > > -- > > > 2.34.1 > > > >
On Tue, Dec 5, 2023 at 4:16 PM Chris Li <chrisl@kernel.org> wrote: > > On Mon, Dec 4, 2023 at 5:39 PM Nhat Pham <nphamcs@gmail.com> wrote: > > > > > > memcg as a candidate for the global limit reclaim. > > > > > > Very minor nitpick. This patch can fold with the later patch that uses > > > it. That makes the review easier, no need to cross reference different > > > patches. It will also make it harder to introduce API that nobody > > > uses. > > > > I don't have a strong preference one way or the other :) Probably not > > worth the churn tho. > > Squashing a patch is very easy. If you are refreshing a new series, it > is worthwhile to do it. I notice on the other thread Yosry pointed out > you did not use the function "mem_cgroup_tryget_online" in patch 3, > that is exactly the situation my suggestion is trying to prevent. I doubt squashing it would solve the issue - in fact, I think Yosry noticed it precisely because he had to stare at a separate patch detailing the adding of the new function in the first place :P In general though, I'm hesitant to extend this API silently in a patch that uses it. Is it not better to have a separate patch announcing this API extension? list_lru_add() was originally part of the original series too - we separate that out to its own thing because it gets confusing. Another benefit is that there will be less work in the future if we want to revert the per-cgroup zswap LRU patch, and there's already another mem_cgroup_tryget_online() user - we can keep this patch. But yeah we'll see - I'll think about it if I actually have to send v9. If not, let's not add unnecessary churning. > > If you don't have a strong preference, it sounds like you should squash it. > > Chris > > > > > > > > > Chris > > > > > > > > > > > Signed-off-by: Nhat Pham <nphamcs@gmail.com> > > > > --- > > > > include/linux/memcontrol.h | 10 ++++++++++ > > > > 1 file changed, 10 insertions(+) > > > > > > > > diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h > > > > index 7bdcf3020d7a..2bd7d14ace78 100644 > > > > --- a/include/linux/memcontrol.h > > > > +++ b/include/linux/memcontrol.h > > > > @@ -821,6 +821,11 @@ static inline bool mem_cgroup_tryget(struct mem_cgroup *memcg) > > > > return !memcg || css_tryget(&memcg->css); > > > > } > > > > > > > > +static inline bool mem_cgroup_tryget_online(struct mem_cgroup *memcg) > > > > +{ > > > > + return !memcg || css_tryget_online(&memcg->css); > > > > +} > > > > + > > > > static inline void mem_cgroup_put(struct mem_cgroup *memcg) > > > > { > > > > if (memcg) > > > > @@ -1349,6 +1354,11 @@ static inline bool mem_cgroup_tryget(struct mem_cgroup *memcg) > > > > return true; > > > > } > > > > > > > > +static inline bool mem_cgroup_tryget_online(struct mem_cgroup *memcg) > > > > +{ > > > > + return true; > > > > +} > > > > + > > > > static inline void mem_cgroup_put(struct mem_cgroup *memcg) > > > > { > > > > } > > > > -- > > > > 2.34.1 > > > > > >
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 7bdcf3020d7a..2bd7d14ace78 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -821,6 +821,11 @@ static inline bool mem_cgroup_tryget(struct mem_cgroup *memcg) return !memcg || css_tryget(&memcg->css); } +static inline bool mem_cgroup_tryget_online(struct mem_cgroup *memcg) +{ + return !memcg || css_tryget_online(&memcg->css); +} + static inline void mem_cgroup_put(struct mem_cgroup *memcg) { if (memcg) @@ -1349,6 +1354,11 @@ static inline bool mem_cgroup_tryget(struct mem_cgroup *memcg) return true; } +static inline bool mem_cgroup_tryget_online(struct mem_cgroup *memcg) +{ + return true; +} + static inline void mem_cgroup_put(struct mem_cgroup *memcg) { }