[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 11 Nov 2022 10:35:28 -0800
From: Kristen Carlson Accardi <kristen@...ux.intel.com>
To: jarkko@...nel.org, dave.hansen@...ux.kernel.org, tj@...nel.org,
linux-kernel@...r.kernel.org, linux-sgx@...r.kernel.org,
cgroups@...r.kernel.org
Cc: zhiquan1.li@...el.com,
Kristen Carlson Accardi <kristen@...ux.intel.com>
Subject: [PATCH 23/26] cgroup/misc: Add tryget functionality for misc controller
Allows caller to do a css_tryget() on a specific misc cgroup.
Signed-off-by: Kristen Carlson Accardi <kristen@...ux.intel.com>
---
include/linux/misc_cgroup.h | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/include/linux/misc_cgroup.h b/include/linux/misc_cgroup.h
index 7fbf3efb0f62..cee848205715 100644
--- a/include/linux/misc_cgroup.h
+++ b/include/linux/misc_cgroup.h
@@ -112,6 +112,16 @@ static inline void put_misc_cg(struct misc_cg *cg)
css_put(&cg->css);
}
+/*
+ * misc_cg_tryget() - Try to increment this misc cgroup ref count.
+ * @cg - cgroup to get.
+ */
+static inline bool misc_cg_tryget(struct misc_cg *cg)
+{
+ if (cg)
+ return css_tryget(&cg->css);
+ return false;
+}
#else /* !CONFIG_CGROUP_MISC */
static inline struct misc_cg *root_misc(void)
{
@@ -175,6 +185,11 @@ static inline void put_misc_cg(struct misc_cg *cg)
{
}
+static inline bool misc_cg_tryget(struct misc_cg *cg)
+{
+ return true;
+}
+
static inline int register_misc_cg_notifier(struct notifier_block *nb)
{
return 0;
--
2.37.3
Powered by blists - more mailing lists