* [PATCH -next] cgroup: move proc_cgroupstats_show() to cgroup.c
@ 2024-04-12 2:54 Xiu Jianfeng
2024-04-12 17:20 ` Tejun Heo
0 siblings, 1 reply; 2+ messages in thread
From: Xiu Jianfeng @ 2024-04-12 2:54 UTC (permalink / raw)
To: tj, lizefan.x, hannes; +Cc: cgroups, linux-kernel
From: Xiu Jianfeng <xiujianfeng@huawei.com>
Currently proc_cgroupstats_show() is in cgroup-v1.c, however it can be
used for v2 too, so it's better to move it cgroup.c.
Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
---
kernel/cgroup/cgroup-internal.h | 1 -
kernel/cgroup/cgroup-v1.c | 21 ---------------------
kernel/cgroup/cgroup.c | 21 +++++++++++++++++++++
3 files changed, 21 insertions(+), 22 deletions(-)
diff --git a/kernel/cgroup/cgroup-internal.h b/kernel/cgroup/cgroup-internal.h
index 520b90dd97ec..9afb39da0d8d 100644
--- a/kernel/cgroup/cgroup-internal.h
+++ b/kernel/cgroup/cgroup-internal.h
@@ -284,7 +284,6 @@ extern struct cftype cgroup1_base_files[];
extern struct kernfs_syscall_ops cgroup1_kf_syscall_ops;
extern const struct fs_parameter_spec cgroup1_fs_parameters[];
-int proc_cgroupstats_show(struct seq_file *m, void *v);
bool cgroup1_ssid_disabled(int ssid);
void cgroup1_pidlist_destroy_all(struct cgroup *cgrp);
void cgroup1_release_agent(struct work_struct *work);
diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c
index 520a11cb12f4..ca22f66b5c64 100644
--- a/kernel/cgroup/cgroup-v1.c
+++ b/kernel/cgroup/cgroup-v1.c
@@ -663,27 +663,6 @@ struct cftype cgroup1_base_files[] = {
{ } /* terminate */
};
-/* Display information about each subsystem and each hierarchy */
-int proc_cgroupstats_show(struct seq_file *m, void *v)
-{
- struct cgroup_subsys *ss;
- int i;
-
- seq_puts(m, "#subsys_name\thierarchy\tnum_cgroups\tenabled\n");
- /*
- * Grab the subsystems state racily. No need to add avenue to
- * cgroup_mutex contention.
- */
-
- for_each_subsys(ss, i)
- seq_printf(m, "%s\t%d\t%d\t%d\n",
- ss->legacy_name, ss->root->hierarchy_id,
- atomic_read(&ss->root->nr_cgrps),
- cgroup_ssid_enabled(i));
-
- return 0;
-}
-
/**
* cgroupstats_build - build and fill cgroupstats
* @stats: cgroupstats to fill information into
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index a66c088c851c..dcdc23d66aa0 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -6028,6 +6028,27 @@ static void __init cgroup_init_subsys(struct cgroup_subsys *ss, bool early)
cgroup_unlock();
}
+/* Display information about each subsystem and each hierarchy */
+static int proc_cgroupstats_show(struct seq_file *m, void *v)
+{
+ struct cgroup_subsys *ss;
+ int i;
+
+ seq_puts(m, "#subsys_name\thierarchy\tnum_cgroups\tenabled\n");
+ /*
+ * Grab the subsystems state racily. No need to add avenue to
+ * cgroup_mutex contention.
+ */
+
+ for_each_subsys(ss, i)
+ seq_printf(m, "%s\t%d\t%d\t%d\n",
+ ss->legacy_name, ss->root->hierarchy_id,
+ atomic_read(&ss->root->nr_cgrps),
+ cgroup_ssid_enabled(i));
+
+ return 0;
+}
+
/**
* cgroup_init_early - cgroup initialization at system boot
*
--
2.34.1
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH -next] cgroup: move proc_cgroupstats_show() to cgroup.c
2024-04-12 2:54 [PATCH -next] cgroup: move proc_cgroupstats_show() to cgroup.c Xiu Jianfeng
@ 2024-04-12 17:20 ` Tejun Heo
0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2024-04-12 17:20 UTC (permalink / raw)
To: Xiu Jianfeng; +Cc: lizefan.x, hannes, cgroups, linux-kernel
Hello,
On Fri, Apr 12, 2024 at 02:54:02AM +0000, Xiu Jianfeng wrote:
> From: Xiu Jianfeng <xiujianfeng@huawei.com>
>
> Currently proc_cgroupstats_show() is in cgroup-v1.c, however it can be
> used for v2 too, so it's better to move it cgroup.c.
This isn't all that useful for cgroup2. I'd rather just leave it as-is.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-04-12 17:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-12 2:54 [PATCH -next] cgroup: move proc_cgroupstats_show() to cgroup.c Xiu Jianfeng
2024-04-12 17:20 ` Tejun Heo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®