Currently, the /proc/cgroups infomation looks messy: / # cat /proc/cgroups #subsys_name hierarchy num_cgroups enabled cpuset 0 1 1 cpu 0 1 1 cpuacct 0 1 1 blkio 0 1 1 memory 0 1 1 devices 0 1 1 freezer 0 1 1 perf_event 0 1 1 hugetlb 0 1 1 pids 0 1 1 This tiny modification makes the information looks better: / # cat /proc/cgroups #subsys_name hierarchy num_cgroups enabled cpuset 0 1 1 cpu 0 1 1 cpuacct 0 1 1 blkio 0 1 1 memory 0 1 1 devices 0 1 1 freezer 0 1 1 perf_event 0 1 1 hugetlb 0 1 1 pids 0 1 1 Changes: Summary for each column: Column name | Column name length Max value length | Max -------------------------------------------------------------------------------- #subsys_name | 12 10 (perf_event) | 12 hierarchy | 9 10 (INT_MAX) | 10 num_cgroups | 11 10 (INT_MAX) | 11 enabled | 7 1 (bool value) | 7 -------------------------------------------------------------------------------- Unit: Character We use the max length values as the length for each column. Besides, insert a white space to 'seq_puts' statement: seq_puts(m, "subsys_name\t hierarchy\tnum_cgroups\tenabled\n"); ^ The purpose is to make the 'hierarchy' column name has the same length as it's possible max value. Signed-off-by: Chingbin Li <liqb365@xxxxxxxxxxx> --- kernel/cgroup/cgroup-v1.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c index 52bb5a74a23b..dbce2e950aa0 100644 --- a/kernel/cgroup/cgroup-v1.c +++ b/kernel/cgroup/cgroup-v1.c @@ -670,14 +670,14 @@ 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"); + seq_puts(m, "#subsys_name\t hierarchy\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", + seq_printf(m, "%12s\t%10d\t%11d\t%7d\n", ss->legacy_name, ss->root->hierarchy_id, atomic_read(&ss->root->nr_cgrps), cgroup_ssid_enabled(i)); -- 2.25.1