aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2012-11-19 11:13:36 -0500
committerTejun Heo <tj@kernel.org>2012-11-19 11:13:36 -0500
commit38b53abaa3e0c7e750ef73eee919cf42eee6b134 (patch)
tree1692ce65068d5df48768564548ec7e4ed4b67da5
parentfebfcef60d4f9457785b45aab548bc7ee5ea158f (diff)
cgroup: make CSS_* flags bit masks instead of bit positions
Currently, CSS_* flags are defined as bit positions and manipulated using atomic bitops. There's no reason to use atomic bitops for them and bit positions are clunkier to deal with than bit masks. Make CSS_* bit masks instead and use the usual C bitwise operators to access them. Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Li Zefan <lizefan@huawei.com>
-rw-r--r--include/linux/cgroup.h8
-rw-r--r--kernel/cgroup.c2
2 files changed, 5 insertions, 5 deletions
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index d605857c4bf3..a0fc64167129 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -81,7 +81,7 @@ struct cgroup_subsys_state {
81 81
82/* bits in struct cgroup_subsys_state flags field */ 82/* bits in struct cgroup_subsys_state flags field */
83enum { 83enum {
84 CSS_ROOT, /* This CSS is the root of the subsystem */ 84 CSS_ROOT = (1 << 0), /* this CSS is the root of the subsystem */
85}; 85};
86 86
87/* Caller must verify that the css is not for root cgroup */ 87/* Caller must verify that the css is not for root cgroup */
@@ -100,7 +100,7 @@ static inline void __css_get(struct cgroup_subsys_state *css, int count)
100static inline void css_get(struct cgroup_subsys_state *css) 100static inline void css_get(struct cgroup_subsys_state *css)
101{ 101{
102 /* We don't need to reference count the root state */ 102 /* We don't need to reference count the root state */
103 if (!test_bit(CSS_ROOT, &css->flags)) 103 if (!(css->flags & CSS_ROOT))
104 __css_get(css, 1); 104 __css_get(css, 1);
105} 105}
106 106
@@ -113,7 +113,7 @@ static inline void css_get(struct cgroup_subsys_state *css)
113extern bool __css_tryget(struct cgroup_subsys_state *css); 113extern bool __css_tryget(struct cgroup_subsys_state *css);
114static inline bool css_tryget(struct cgroup_subsys_state *css) 114static inline bool css_tryget(struct cgroup_subsys_state *css)
115{ 115{
116 if (test_bit(CSS_ROOT, &css->flags)) 116 if (css->flags & CSS_ROOT)
117 return true; 117 return true;
118 return __css_tryget(css); 118 return __css_tryget(css);
119} 119}
@@ -126,7 +126,7 @@ static inline bool css_tryget(struct cgroup_subsys_state *css)
126extern void __css_put(struct cgroup_subsys_state *css); 126extern void __css_put(struct cgroup_subsys_state *css);
127static inline void css_put(struct cgroup_subsys_state *css) 127static inline void css_put(struct cgroup_subsys_state *css)
128{ 128{
129 if (!test_bit(CSS_ROOT, &css->flags)) 129 if (!(css->flags & CSS_ROOT))
130 __css_put(css); 130 __css_put(css);
131} 131}
132 132
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index affc76d7f739..82ad8785fafe 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -4020,7 +4020,7 @@ static void init_cgroup_css(struct cgroup_subsys_state *css,
4020 css->flags = 0; 4020 css->flags = 0;
4021 css->id = NULL; 4021 css->id = NULL;
4022 if (cgrp == dummytop) 4022 if (cgrp == dummytop)
4023 set_bit(CSS_ROOT, &css->flags); 4023 css->flags |= CSS_ROOT;
4024 BUG_ON(cgrp->subsys[ss->subsys_id]); 4024 BUG_ON(cgrp->subsys[ss->subsys_id]);
4025 cgrp->subsys[ss->subsys_id] = css; 4025 cgrp->subsys[ss->subsys_id] = css;
4026 4026