diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/cgroup.h | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index 028478c6e0c5..be81fafae11f 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h | |||
@@ -115,16 +115,12 @@ static inline bool css_is_removed(struct cgroup_subsys_state *css) | |||
115 | * the css has been destroyed. | 115 | * the css has been destroyed. |
116 | */ | 116 | */ |
117 | 117 | ||
118 | extern bool __css_tryget(struct cgroup_subsys_state *css); | ||
118 | static inline bool css_tryget(struct cgroup_subsys_state *css) | 119 | static inline bool css_tryget(struct cgroup_subsys_state *css) |
119 | { | 120 | { |
120 | if (test_bit(CSS_ROOT, &css->flags)) | 121 | if (test_bit(CSS_ROOT, &css->flags)) |
121 | return true; | 122 | return true; |
122 | while (!atomic_inc_not_zero(&css->refcnt)) { | 123 | return __css_tryget(css); |
123 | if (test_bit(CSS_REMOVED, &css->flags)) | ||
124 | return false; | ||
125 | cpu_relax(); | ||
126 | } | ||
127 | return true; | ||
128 | } | 124 | } |
129 | 125 | ||
130 | /* | 126 | /* |
@@ -132,11 +128,11 @@ static inline bool css_tryget(struct cgroup_subsys_state *css) | |||
132 | * css_get() or css_tryget() | 128 | * css_get() or css_tryget() |
133 | */ | 129 | */ |
134 | 130 | ||
135 | extern void __css_put(struct cgroup_subsys_state *css, int count); | 131 | extern void __css_put(struct cgroup_subsys_state *css); |
136 | static inline void css_put(struct cgroup_subsys_state *css) | 132 | static inline void css_put(struct cgroup_subsys_state *css) |
137 | { | 133 | { |
138 | if (!test_bit(CSS_ROOT, &css->flags)) | 134 | if (!test_bit(CSS_ROOT, &css->flags)) |
139 | __css_put(css, 1); | 135 | __css_put(css); |
140 | } | 136 | } |
141 | 137 | ||
142 | /* bits in struct cgroup flags field */ | 138 | /* bits in struct cgroup flags field */ |