[PATCH OLK-5.10] psi: fix compile error for psi cgroupv1 when CONFIG_CGROUP=n

hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I7OOZR ------------------------------- When CONFIG_CGROUP=n ,the compile error is: In file included from kernel/sched/core.c:13: kernel/sched/sched.h:2679:22: error: array type has incomplete element type ‘struct cftype’ extern struct cftype cgroup_v1_psi_files[]; ^~~~~~~~~~~~~~~~~~~ the reason is then CONFIG_CGROUP=n, struct cftype is not defined. We also find that, cgroup_v1_psi_files is used only in kernel/cgroup/cgroup.c and kernel/sched/cpuacct.c. Therefore, move extern struct cftype cgroup_v1_psi_files to kernel/sched/cpuacct.c.This also solved the compile error, because, then CONFIG_CGROUP=n, CONFIG_CGROUP_CPUACCT=n, the kernel/sched/cpuacct.c is not compiled, which will solve the compile error. Signed-off-by: Lu Jialin <lujialin4@huawei.com> --- kernel/sched/cpuacct.c | 1 + kernel/sched/sched.h | 4 ---- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/kernel/sched/cpuacct.c b/kernel/sched/cpuacct.c index 5c00d3dcee8d..28ed182b6801 100644 --- a/kernel/sched/cpuacct.c +++ b/kernel/sched/cpuacct.c @@ -390,6 +390,7 @@ static int __init setup_psi_v1(char *str) } __setup("psi_v1=", setup_psi_v1); +extern struct cftype cgroup_v1_psi_files[]; static int __init cgroup_v1_psi_init(void) { if (!psi_v1_enable) diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 95ae9ac553fc..50f1a11ac2fd 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -2977,10 +2977,6 @@ unsigned long scale_irq_capacity(unsigned long util, unsigned long irq, unsigned } #endif -#ifdef CONFIG_PSI -extern struct cftype cgroup_v1_psi_files[]; -#endif - #if defined(CONFIG_ENERGY_MODEL) && defined(CONFIG_CPU_FREQ_GOV_SCHEDUTIL) #define perf_domain_span(pd) (to_cpumask(((pd)->em_pd->cpus))) -- 2.17.1

反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://gitee.com/openeuler/kernel/pulls/1581 邮件列表地址:https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/P... FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://gitee.com/openeuler/kernel/pulls/1581 Mailing list address: https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/P...
-
Lu Jialin
-
patchwork bot