lkml.org 
[lkml]   [2022]   [Nov]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 23/26] cgroup/misc: Add tryget functionality for misc controller
Date
Allows caller to do a css_tryget() on a specific misc cgroup.

Signed-off-by: Kristen Carlson Accardi <kristen@linux.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
\
 
 \ /
  Last update: 2022-11-11 19:39    [W:0.202 / U:0.764 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site