Skip to content

Commit 76be05d

Browse files
committed
cgroup: fix build when CGROUP_SCHED is not enabled
Sudip Mukherjee reports that the mips sb1250_swarm_defconfig build fails with the current kernel. It isn't actually MIPS-specific, it's just that that defconfig does not have CGROUP_SCHED enabled like most configs do, and as such shows this error: kernel/cgroup/cgroup.c: In function 'cgroup_local_stat_show': kernel/cgroup/cgroup.c:3699:15: error: implicit declaration of function 'cgroup_tryget_css'; did you mean 'cgroup_tryget'? [-Werror=implicit-function-declaration] 3699 | css = cgroup_tryget_css(cgrp, ss); | ^~~~~~~~~~~~~~~~~ | cgroup_tryget kernel/cgroup/cgroup.c:3699:13: warning: assignment to 'struct cgroup_subsys_state *' from 'int' makes pointer from integer without a cast [-Wint-conversion] 3699 | css = cgroup_tryget_css(cgrp, ss); | ^ because cgroup_tryget_css() only exists when CGROUP_SCHED is enabled, and the cgroup_local_stat_show() function should similarly be guarded by that config option. Move things around a bit to fix this all. Fixes: d1d4ff5 ("cgroup: put cgroup_tryget_css() inside CONFIG_CGROUP_SCHED") Reported-by: Sudip Mukherjee <[email protected]> Cc: Miaohe Lin <[email protected]> Cc: Tejun Heo <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 8df0f84 commit 76be05d

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

kernel/cgroup/cgroup.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3673,21 +3673,9 @@ static int cgroup_extra_stat_show(struct seq_file *seq, int ssid)
36733673
css_put(css);
36743674
return ret;
36753675
}
3676-
#endif
3677-
3678-
static int cpu_stat_show(struct seq_file *seq, void *v)
3679-
{
3680-
int ret = 0;
3681-
3682-
cgroup_base_stat_cputime_show(seq);
3683-
#ifdef CONFIG_CGROUP_SCHED
3684-
ret = cgroup_extra_stat_show(seq, cpu_cgrp_id);
3685-
#endif
3686-
return ret;
3687-
}
36883676

3689-
static int __maybe_unused cgroup_local_stat_show(struct seq_file *seq,
3690-
struct cgroup *cgrp, int ssid)
3677+
static int cgroup_local_stat_show(struct seq_file *seq,
3678+
struct cgroup *cgrp, int ssid)
36913679
{
36923680
struct cgroup_subsys *ss = cgroup_subsys[ssid];
36933681
struct cgroup_subsys_state *css;
@@ -3704,6 +3692,18 @@ static int __maybe_unused cgroup_local_stat_show(struct seq_file *seq,
37043692
css_put(css);
37053693
return ret;
37063694
}
3695+
#endif
3696+
3697+
static int cpu_stat_show(struct seq_file *seq, void *v)
3698+
{
3699+
int ret = 0;
3700+
3701+
cgroup_base_stat_cputime_show(seq);
3702+
#ifdef CONFIG_CGROUP_SCHED
3703+
ret = cgroup_extra_stat_show(seq, cpu_cgrp_id);
3704+
#endif
3705+
return ret;
3706+
}
37073707

37083708
static int cpu_local_stat_show(struct seq_file *seq, void *v)
37093709
{

0 commit comments

Comments
 (0)