diff options
author | Tejun Heo <tj@kernel.org> | 2014-05-13 12:11:01 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2014-05-13 12:11:01 -0400 |
commit | ec903c0c858e4963a9e0724bdcadfa837253341c (patch) | |
tree | b52cd0d5bcac48d2d9c21e6186397c29ef89c33b /include | |
parent | 46cfeb043b04f5878154bea36714709d46028495 (diff) |
cgroup: rename css_tryget*() to css_tryget_online*()
Unlike the more usual refcnting, what css_tryget() provides is the
distinction between online and offline csses instead of protection
against upping a refcnt which already reached zero. cgroup is
planning to provide actual tryget which fails if the refcnt already
reached zero. Let's rename the existing trygets so that they clearly
indicate that they're onliness.
I thought about keeping the existing names as-are and introducing new
names for the planned actual tryget; however, given that each
controller participates in the synchronization of the online state, it
seems worthwhile to make it explicit that these functions are about
on/offline state.
Rename css_tryget() to css_tryget_online() and css_tryget_from_dir()
to css_tryget_online_from_dir(). This is pure rename.
v2: cgroup_freezer grew new usages of css_tryget(). Update
accordingly.
Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: Michal Hocko <mhocko@suse.cz>
Acked-by: Li Zefan <lizefan@huawei.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/cgroup.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index bde44618d8c2..c5f3684ef557 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h | |||
@@ -95,16 +95,16 @@ static inline void css_get(struct cgroup_subsys_state *css) | |||
95 | } | 95 | } |
96 | 96 | ||
97 | /** | 97 | /** |
98 | * css_tryget - try to obtain a reference on the specified css | 98 | * css_tryget_online - try to obtain a reference on the specified css if online |
99 | * @css: target css | 99 | * @css: target css |
100 | * | 100 | * |
101 | * Obtain a reference on @css if it's alive. The caller naturally needs to | 101 | * Obtain a reference on @css if it's online. The caller naturally needs |
102 | * ensure that @css is accessible but doesn't have to be holding a | 102 | * to ensure that @css is accessible but doesn't have to be holding a |
103 | * reference on it - IOW, RCU protected access is good enough for this | 103 | * reference on it - IOW, RCU protected access is good enough for this |
104 | * function. Returns %true if a reference count was successfully obtained; | 104 | * function. Returns %true if a reference count was successfully obtained; |
105 | * %false otherwise. | 105 | * %false otherwise. |
106 | */ | 106 | */ |
107 | static inline bool css_tryget(struct cgroup_subsys_state *css) | 107 | static inline bool css_tryget_online(struct cgroup_subsys_state *css) |
108 | { | 108 | { |
109 | if (css->flags & CSS_ROOT) | 109 | if (css->flags & CSS_ROOT) |
110 | return true; | 110 | return true; |
@@ -115,7 +115,7 @@ static inline bool css_tryget(struct cgroup_subsys_state *css) | |||
115 | * css_put - put a css reference | 115 | * css_put - put a css reference |
116 | * @css: target css | 116 | * @css: target css |
117 | * | 117 | * |
118 | * Put a reference obtained via css_get() and css_tryget(). | 118 | * Put a reference obtained via css_get() and css_tryget_online(). |
119 | */ | 119 | */ |
120 | static inline void css_put(struct cgroup_subsys_state *css) | 120 | static inline void css_put(struct cgroup_subsys_state *css) |
121 | { | 121 | { |
@@ -905,8 +905,8 @@ void css_task_iter_end(struct css_task_iter *it); | |||
905 | int cgroup_attach_task_all(struct task_struct *from, struct task_struct *); | 905 | int cgroup_attach_task_all(struct task_struct *from, struct task_struct *); |
906 | int cgroup_transfer_tasks(struct cgroup *to, struct cgroup *from); | 906 | int cgroup_transfer_tasks(struct cgroup *to, struct cgroup *from); |
907 | 907 | ||
908 | struct cgroup_subsys_state *css_tryget_from_dir(struct dentry *dentry, | 908 | struct cgroup_subsys_state *css_tryget_online_from_dir(struct dentry *dentry, |
909 | struct cgroup_subsys *ss); | 909 | struct cgroup_subsys *ss); |
910 | 910 | ||
911 | #else /* !CONFIG_CGROUPS */ | 911 | #else /* !CONFIG_CGROUPS */ |
912 | 912 | ||