Allows caller to do a css_tryget() on a specific misc cgroup. Signed-off-by: Kristen Carlson Accardi <kristen@xxxxxxxxxxxxxxx> --- 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