cgroup-v1: tweak the output format of cgroupstats

Message ID 20230606130649.485821-1-linmiaohe@huawei.com
State New
Headers
Series cgroup-v1: tweak the output format of cgroupstats |

Commit Message

Miaohe Lin June 6, 2023, 1:06 p.m. UTC
  The output of /proc/cgroups is somewhat awful now. For example, it may
look like below:

subsys_name	hierarchy	num_cgroups	enabled
cpuset	7	95	1
...
perf_event	6	1	1
...
files	10	1	1

Tweak the output format of cgroup stats to make it look better. After
patch applied, it will look like below:

subsys_name	hierarchy	num_cgroups	enabled
cpuset      	11       	73         	1
...
perf_event  	10       	1          	1
...
files       	7        	1          	1

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
 kernel/cgroup/cgroup-v1.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Patch

diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c
index aeef06c465ef..916871babeea 100644
--- a/kernel/cgroup/cgroup-v1.c
+++ b/kernel/cgroup/cgroup-v1.c
@@ -677,7 +677,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));