diff options
Diffstat (limited to 'include/linux/cgroup.h')
-rw-r--r-- | include/linux/cgroup.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index d08cfe7e12e5..14160b5b693f 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h | |||
@@ -76,6 +76,12 @@ enum { | |||
76 | CSS_REMOVED, /* This CSS is dead */ | 76 | CSS_REMOVED, /* This CSS is dead */ |
77 | }; | 77 | }; |
78 | 78 | ||
79 | /* Caller must verify that the css is not for root cgroup */ | ||
80 | static inline void __css_get(struct cgroup_subsys_state *css, int count) | ||
81 | { | ||
82 | atomic_add(count, &css->refcnt); | ||
83 | } | ||
84 | |||
79 | /* | 85 | /* |
80 | * Call css_get() to hold a reference on the css; it can be used | 86 | * Call css_get() to hold a reference on the css; it can be used |
81 | * for a reference obtained via: | 87 | * for a reference obtained via: |
@@ -87,7 +93,7 @@ static inline void css_get(struct cgroup_subsys_state *css) | |||
87 | { | 93 | { |
88 | /* We don't need to reference count the root state */ | 94 | /* We don't need to reference count the root state */ |
89 | if (!test_bit(CSS_ROOT, &css->flags)) | 95 | if (!test_bit(CSS_ROOT, &css->flags)) |
90 | atomic_inc(&css->refcnt); | 96 | __css_get(css, 1); |
91 | } | 97 | } |
92 | 98 | ||
93 | static inline bool css_is_removed(struct cgroup_subsys_state *css) | 99 | static inline bool css_is_removed(struct cgroup_subsys_state *css) |
@@ -118,11 +124,11 @@ static inline bool css_tryget(struct cgroup_subsys_state *css) | |||
118 | * css_get() or css_tryget() | 124 | * css_get() or css_tryget() |
119 | */ | 125 | */ |
120 | 126 | ||
121 | extern void __css_put(struct cgroup_subsys_state *css); | 127 | extern void __css_put(struct cgroup_subsys_state *css, int count); |
122 | static inline void css_put(struct cgroup_subsys_state *css) | 128 | static inline void css_put(struct cgroup_subsys_state *css) |
123 | { | 129 | { |
124 | if (!test_bit(CSS_ROOT, &css->flags)) | 130 | if (!test_bit(CSS_ROOT, &css->flags)) |
125 | __css_put(css); | 131 | __css_put(css, 1); |
126 | } | 132 | } |
127 | 133 | ||
128 | /* bits in struct cgroup flags field */ | 134 | /* bits in struct cgroup flags field */ |