diff options
author | Miaohe Lin <linmiaohe@huawei.com> | 2023-07-11 10:38:20 +0800 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2023-07-11 11:46:00 -1000 |
commit | d1d4ff5d11a5887a9c4cfc00294bc68ba03e7c16 (patch) | |
tree | 270b865018cdb0d0afd0f1ae97a5d6b4cbdc7c5e /kernel/cgroup | |
parent | 3ae0b773211ed0231e7ee3e8d28ec4ab9bc5134b (diff) | |
download | linux-d1d4ff5d11a5887a9c4cfc00294bc68ba03e7c16.tar.gz linux-d1d4ff5d11a5887a9c4cfc00294bc68ba03e7c16.tar.bz2 linux-d1d4ff5d11a5887a9c4cfc00294bc68ba03e7c16.zip |
cgroup: put cgroup_tryget_css() inside CONFIG_CGROUP_SCHED
Put cgroup_tryget_css() inside CONFIG_CGROUP_SCHED to fix the warning
of 'cgroup_tryget_css' defined but not used [-Wunused-function] when
CONFIG_CGROUP_SCHED is disabled.
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Reviewed-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'kernel/cgroup')
-rw-r--r-- | kernel/cgroup/cgroup.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c index 13d9ea33eb6d..30c9c2503ccf 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -493,28 +493,6 @@ static struct cgroup_subsys_state *cgroup_css(struct cgroup *cgrp, } /** - * cgroup_tryget_css - try to get a cgroup's css for the specified subsystem - * @cgrp: the cgroup of interest - * @ss: the subsystem of interest - * - * Find and get @cgrp's css associated with @ss. If the css doesn't exist - * or is offline, %NULL is returned. - */ -static struct cgroup_subsys_state *cgroup_tryget_css(struct cgroup *cgrp, - struct cgroup_subsys *ss) -{ - struct cgroup_subsys_state *css; - - rcu_read_lock(); - css = cgroup_css(cgrp, ss); - if (css && !css_tryget_online(css)) - css = NULL; - rcu_read_unlock(); - - return css; -} - -/** * cgroup_e_css_by_mask - obtain a cgroup's effective css for the specified ss * @cgrp: the cgroup of interest * @ss: the subsystem of interest (%NULL returns @cgrp->self) @@ -3655,6 +3633,28 @@ static int cgroup_stat_show(struct seq_file *seq, void *v) } #ifdef CONFIG_CGROUP_SCHED +/** + * cgroup_tryget_css - try to get a cgroup's css for the specified subsystem + * @cgrp: the cgroup of interest + * @ss: the subsystem of interest + * + * Find and get @cgrp's css associated with @ss. If the css doesn't exist + * or is offline, %NULL is returned. + */ +static struct cgroup_subsys_state *cgroup_tryget_css(struct cgroup *cgrp, + struct cgroup_subsys *ss) +{ + struct cgroup_subsys_state *css; + + rcu_read_lock(); + css = cgroup_css(cgrp, ss); + if (css && !css_tryget_online(css)) + css = NULL; + rcu_read_unlock(); + + return css; +} + static int cgroup_extra_stat_show(struct seq_file *seq, int ssid) { struct cgroup *cgrp = seq_css(seq)->cgroup; |