cgroup: pretty format /proc/cgroups
PATCH v2 1/1 cgroup: pretty format /proc/cgroups
Current /proc/cgroups looks like this:
subsys_name hierarchy num_cgroups enabled cpuset 3 1 1 cpu 2 1 1 cpuacct 2 1 1 memory 4 71 1 freezer 5 1 1
Let's align the title and value. After this patch, it looks like this.
subsys_name hierarchy num_cgroups enabled
cpuset 5 1 1
cpu 3 1 1
cpuacct 3 1 1
memory 2 71 1
freezer 4 1 1---
v2: the title line is omitted for the start "#"
--- kernel/cgroup/cgroup-v1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/cgroup/cgroup-v1.c +1 -1
@@ -664,7 +664,7 @@ int proc_cgroupstats_show(struct seq_file *m, void *v)*/ for_each_subsys (ss, i) -seq_printf (m,"%s\t%d\t%d\t%d\n" , +seq_printf (m,"%12s\t%9d\t%11d\t%7d\n" , ss->legacy_name, ss->root->hierarchy_id,atomic_read (&ss->root->nr_cgrps),cgroup_ssid_enabled (i));
Signature · 1 line
2.33.1
Tejun Heo
maintainerQuoted 11 lines · Wei Yang
Current
/proc/cgroupslooks like this:subsys_name hierarchy num_cgroups enabled cpuset 3 1 1 cpu 2 1 1 cpuacct 2 1 1 memory 4 71 1 freezer 5 1 1Let's align the title and value. After this patch, it looks like this.
Quoted 8 lines
subsys_namehierarchynum_cgroupsenabledcpuset 5 1 1 cpu 3 1 1 cpuacct 3 1 1 memory 2 71 1 freezer 4 1 1Signed-off-by Wei Yang <[email protected]>
So, I know it's silly but the file is dumb \t formatted (ie. single \t between fields) and am slightly worried that changing the format might break some dumb userspace tooling. Given that the information isn't really needed for cgroup2 anyway, it prolly is better to leave it as-is, I think.
Thanks.
Signature · 1 line
tejun
Michal Koutný
maintainerHello.
Quoted 1 line · Wei Yang
Let's align the title and value. After this patch, it looks like this.
For machines this change may come as a surprise (so better not change it).
For humans (for instance column from util-linux)
$ column -t /proc/cgroups #subsys_name hierarchy num_cgroups enabled cpuset 11 2 1 cpu 4 9 1 cpuacct 4 9 1 ...
Michal
Quoted 8 lines · Michal Koutn?
Hello.
Quoted 1 line · Wei Yang
Let's align the title and value. After this patch, it looks like this.
For machines this change may come as a surprise (so better not change it).
Quoted 9 lines
For humans (for instance column from util-linux)
$ column -t /proc/cgroups #subsys_name hierarchy num_cgroups enabled cpuset 11 2 1 cpu 4 9 1 cpuacct 4 9 1 ...
This is helpful, thanks.
Quoted 1 line
Michal
Signature · 2 lines
Wei Yang Help you, Help me