lkml.org 
[lkml]   [2024]   [Apr]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] cgroup: make cgroups info more readable
Date
The current cgroups output format is based on tabs, which
may cause misalignment of output information.

Using placeholder formatting can make the output information
more readable.

Signed-off-by: Huan Yang <link@vivo.com>
---
kernel/cgroup/cgroup-v1.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c
index 520a11cb12f4..c082a78f4c22 100644
--- a/kernel/cgroup/cgroup-v1.c
+++ b/kernel/cgroup/cgroup-v1.c
@@ -669,15 +669,16 @@ 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_printf(m, "%16s %16s %16s %16s\n", "#subsys_name", "hierarchy",
+ "num_cgroups", "enabled");
/*
* 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,
+ seq_printf(m, "%16s %16d %16d %16d\n", ss->legacy_name,
+ ss->root->hierarchy_id,
atomic_read(&ss->root->nr_cgrps),
cgroup_ssid_enabled(i));

--
2.34.1

\
 
 \ /
  Last update: 2024-04-09 04:18    [W:0.072 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site