Skip to contentSkip to conversation

cgroup: pretty format /proc/cgroups

PATCH Superseded Wei Yang 1 participant 1 message Nov 15, 2021 cgroup

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Wei Yang

author
#0 lore raw

PATCH 1/1 cgroup: pretty format /proc/cgroups

Current /proc/cgroups looks like this:

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.

      cpuset            5                 1           1
         cpu            3                 1           1
     cpuacct            3                 1           1
      memory            2                71           1
     freezer            4                 1           1
---
 kernel/cgroup/cgroup-v1.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/cgroup/cgroup-v1.c +1 -1
index 81c9e0685948..5b177e0eca2c 100644
@@ -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