public inbox for cgroups@vger.kernel.org
 help / color / mirror / Atom feed
From: Feng Tang <feng.tang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Zefan Li <lizefan.x-EC8Uxl6Npydl57MIdRCFDg@public.gmane.org>,
	Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>,
	cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Feng Tang <feng.tang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Subject: [PATCH] cgroup: cleanup the format of /proc/cgroups
Date: Sun, 21 Aug 2022 15:34:46 +0800	[thread overview]
Message-ID: <20220821073446.92669-1-feng.tang@intel.com> (raw)

Currrent /proc/cgroup output is like:

  #subsys_name	hierarchy	num_cgroups	enabled
  cpuset	6	1	1
  cpu	4	7	1
  cpuacct	4	7	1
  blkio	8	7	1
  memory	9	7	1
  ...

Add some indentation to make it more readable without any functional
change:

  #subsys_name         hierarchy        num_cgroups      enabled
  cpuset               8                1                1
  cpu                  4                7                1
  cpuacct              4                7                1
  blkio                2                7                1
  memory               5                7                1
  ...

Signed-off-by: Feng Tang <feng.tang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 kernel/cgroup/cgroup-v1.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c
index 2ade21b54dc4..e370ce3afdad 100644
--- a/kernel/cgroup/cgroup-v1.c
+++ b/kernel/cgroup/cgroup-v1.c
@@ -670,14 +670,20 @@ 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, "%-20s %-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",
+		seq_printf(m, "%-20s %-16d %-16d %-16d\n",
 			   ss->legacy_name, ss->root->hierarchy_id,
 			   atomic_read(&ss->root->nr_cgrps),
 			   cgroup_ssid_enabled(i));
-- 
2.27.0


             reply	other threads:[~2022-08-21  7:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-21  7:34 Feng Tang [this message]
     [not found] ` <20220821073446.92669-1-feng.tang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2022-08-22  7:30   ` [PATCH] cgroup: cleanup the format of /proc/cgroups Tejun Heo
     [not found]     ` <YwMwlMv/tK3sRXbB-NiLfg/pYEd1N0TnZuCh8vA@public.gmane.org>
2022-08-22  7:52       ` Feng Tang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220821073446.92669-1-feng.tang@intel.com \
    --to=feng.tang-ral2jqcrhueavxtiumwx3w@public.gmane.org \
    --cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org \
    --cc=lizefan.x-EC8Uxl6Npydl57MIdRCFDg@public.gmane.org \
    --cc=tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox