Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: d1d4ff5d11a5 ("cgroup: put cgroup_tryget_css() inside CONFIG_CGROUP_SCHED")
Reported-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Cc: Miaohe Lin <linmiaohe@huawei.com>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

+14 -14
+14 -14
kernel/cgroup/cgroup.c
··· 3673 3673 css_put(css); 3674 3674 return ret; 3675 3675 } 3676 - #endif 3677 3676 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 - } 3688 - 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) 3691 3679 { 3692 3680 struct cgroup_subsys *ss = cgroup_subsys[ssid]; 3693 3681 struct cgroup_subsys_state *css; ··· 3690 3702 3691 3703 ret = ss->css_local_stat_show(seq, css); 3692 3704 css_put(css); 3705 + return ret; 3706 + } 3707 + #endif 3708 + 3709 + static int cpu_stat_show(struct seq_file *seq, void *v) 3710 + { 3711 + int ret = 0; 3712 + 3713 + cgroup_base_stat_cputime_show(seq); 3714 + #ifdef CONFIG_CGROUP_SCHED 3715 + ret = cgroup_extra_stat_show(seq, cpu_cgrp_id); 3716 + #endif 3693 3717 return ret; 3694 3718 } 3695 3719