hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I8U6EM
--------------------------------
Export cgroup.stat feature from cgroupv2 to cgroupv1. Therefore, user can get dying descendants cgroup number and descendants number in cgroupv1. --- arch/arm64/configs/openeuler_defconfig | 1 + arch/x86/configs/openeuler_defconfig | 1 + init/Kconfig | 5 +++++ kernel/cgroup/cgroup-internal.h | 1 + kernel/cgroup/cgroup-v1.c | 6 ++++++ kernel/cgroup/cgroup.c | 2 +- 6 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/configs/openeuler_defconfig b/arch/arm64/configs/openeuler_defconfig index 9a053bc885dd..1fc527e975be 100644 --- a/arch/arm64/configs/openeuler_defconfig +++ b/arch/arm64/configs/openeuler_defconfig @@ -188,6 +188,7 @@ CONFIG_CGROUP_BPF=y # CONFIG_CGROUP_DEBUG is not set CONFIG_SOCK_CGROUP_DATA=y CONFIG_CGROUP_V1_KILL=y +CONFIG_CGROUP_V1_STAT=y CONFIG_CGROUP_FILES=y CONFIG_NAMESPACES=y CONFIG_UTS_NS=y diff --git a/arch/x86/configs/openeuler_defconfig b/arch/x86/configs/openeuler_defconfig index 4bf011ed6307..0980126766cc 100644 --- a/arch/x86/configs/openeuler_defconfig +++ b/arch/x86/configs/openeuler_defconfig @@ -209,6 +209,7 @@ CONFIG_CGROUP_BPF=y # CONFIG_CGROUP_DEBUG is not set CONFIG_SOCK_CGROUP_DATA=y CONFIG_CGROUP_V1_KILL=y +CONFIG_CGROUP_V1_STAT=y CONFIG_CGROUP_FILES=y CONFIG_NAMESPACES=y CONFIG_UTS_NS=y diff --git a/init/Kconfig b/init/Kconfig index 869eea4108d0..fad38e359428 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -1254,6 +1254,11 @@ config CGROUP_V1_KILL default n depends on CGROUPS
+config CGROUP_V1_STAT + bool "Getting Cgroup Stat in Cgroup V1" + default n + depends on CGROUPS + config CGROUP_FILES bool "Files Resource Controller for Control Groups" select PAGE_COUNTER diff --git a/kernel/cgroup/cgroup-internal.h b/kernel/cgroup/cgroup-internal.h index d5a197d4b0ec..96a9bd2c26f0 100644 --- a/kernel/cgroup/cgroup-internal.h +++ b/kernel/cgroup/cgroup-internal.h @@ -266,6 +266,7 @@ int cgroup_task_count(const struct cgroup *cgrp);
ssize_t cgroup_kill_write(struct kernfs_open_file *of, char *buf, size_t nbytes, loff_t off); +int cgroup_stat_show(struct seq_file *seq, void *v);
/* * rstat.c diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c index 622398d492b6..ece2f4e17197 100644 --- a/kernel/cgroup/cgroup-v1.c +++ b/kernel/cgroup/cgroup-v1.c @@ -666,6 +666,12 @@ struct cftype cgroup1_base_files[] = { .flags = CFTYPE_NOT_ON_ROOT, .write = cgroup_kill_write, }, +#endif +#ifdef CONFIG_CGROUP_V1_STAT + { + .name = "cgroup.stat", + .seq_show = cgroup_stat_show, + }, #endif { } /* terminate */ }; diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c index cfae217e6e7f..36707df23cfd 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -3657,7 +3657,7 @@ static int cgroup_events_show(struct seq_file *seq, void *v) return 0; }
-static int cgroup_stat_show(struct seq_file *seq, void *v) +int cgroup_stat_show(struct seq_file *seq, void *v) { struct cgroup *cgroup = seq_css(seq)->cgroup;
反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://gitee.com/openeuler/kernel/pulls/3842 邮件列表地址:https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/C...
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/3842 Mailing list address: https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/C...