* [PATCH] cgroup: put cgroup_tryget_css() inside CONFIG_CGROUP_SCHED
@ 2023-07-11 2:38 Miaohe Lin
2023-07-11 7:20 ` Kamalesh Babulal
2023-07-11 21:46 ` Tejun Heo
0 siblings, 2 replies; 3+ messages in thread
From: Miaohe Lin @ 2023-07-11 2:38 UTC (permalink / raw)
To: tj, hannes, sfr, lizefan.x; +Cc: cgroups, linux-kernel, linux-next, linmiaohe
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>
---
kernel/cgroup/cgroup.c | 44 +++++++++++++++++++++---------------------
1 file changed, 22 insertions(+), 22 deletions(-)
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index b990eda6b3cd..46401157028e 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -492,28 +492,6 @@ static struct cgroup_subsys_state *cgroup_css(struct cgroup *cgrp,
return &cgrp->self;
}
-/**
- * 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
@@ -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;
--
2.33.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] cgroup: put cgroup_tryget_css() inside CONFIG_CGROUP_SCHED
2023-07-11 2:38 [PATCH] cgroup: put cgroup_tryget_css() inside CONFIG_CGROUP_SCHED Miaohe Lin
@ 2023-07-11 7:20 ` Kamalesh Babulal
2023-07-11 21:46 ` Tejun Heo
1 sibling, 0 replies; 3+ messages in thread
From: Kamalesh Babulal @ 2023-07-11 7:20 UTC (permalink / raw)
To: Miaohe Lin, tj, hannes, sfr, lizefan.x; +Cc: cgroups, linux-kernel, linux-next
On 7/11/23 08:08, Miaohe Lin wrote:
> 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>
> ---
> kernel/cgroup/cgroup.c | 44 +++++++++++++++++++++---------------------
> 1 file changed, 22 insertions(+), 22 deletions(-)
Looks good to me, given that the only caller cgroup_extra_stat_show() is
guarded within CONFIG_CGROUP_SCHED (linux-next tree), it makes sense to,
also move cgroup_tryget_css() within the same ifdef block.
Reviewed-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] cgroup: put cgroup_tryget_css() inside CONFIG_CGROUP_SCHED
2023-07-11 2:38 [PATCH] cgroup: put cgroup_tryget_css() inside CONFIG_CGROUP_SCHED Miaohe Lin
2023-07-11 7:20 ` Kamalesh Babulal
@ 2023-07-11 21:46 ` Tejun Heo
1 sibling, 0 replies; 3+ messages in thread
From: Tejun Heo @ 2023-07-11 21:46 UTC (permalink / raw)
To: Miaohe Lin; +Cc: hannes, sfr, lizefan.x, cgroups, linux-kernel, linux-next
On Tue, Jul 11, 2023 at 10:38:20AM +0800, Miaohe Lin wrote:
> 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>
Applied to cgroup/for-6.6.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-07-11 21:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-11 2:38 [PATCH] cgroup: put cgroup_tryget_css() inside CONFIG_CGROUP_SCHED Miaohe Lin
2023-07-11 7:20 ` Kamalesh Babulal
2023-07-11 21:46 ` Tejun Heo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).