public inbox for cgroups@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cgroup: cleanup the format of /proc/cgroups
@ 2022-08-21  7:34 Feng Tang
       [not found] ` <20220821073446.92669-1-feng.tang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Feng Tang @ 2022-08-21  7:34 UTC (permalink / raw)
  To: Tejun Heo, Zefan Li, Johannes Weiner,
	cgroups-u79uwXL29TY76Z2rM5mHXA
  Cc: Feng Tang

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] cgroup: cleanup the format of /proc/cgroups
       [not found] ` <20220821073446.92669-1-feng.tang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
@ 2022-08-22  7:30   ` Tejun Heo
       [not found]     ` <YwMwlMv/tK3sRXbB-NiLfg/pYEd1N0TnZuCh8vA@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Tejun Heo @ 2022-08-22  7:30 UTC (permalink / raw)
  To: Feng Tang; +Cc: Zefan Li, Johannes Weiner, cgroups-u79uwXL29TY76Z2rM5mHXA

Hello,

On Sun, Aug 21, 2022 at 03:34:46PM +0800, Feng Tang wrote:
> 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:

So, this has been suggested a couple times before and I fully agree that the
file is really ugly. In the past, we didn't pull the trigger on it for two
reasons - 1. It is user-visible functional change in that it can break
really dumb parsers 2. the file is only useful for cgroup1 which has been in
mostly maintenance mode for many years now. I don't feel that strongly
either way but still kinda lean towards just leaving it as-is.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] cgroup: cleanup the format of /proc/cgroups
       [not found]     ` <YwMwlMv/tK3sRXbB-NiLfg/pYEd1N0TnZuCh8vA@public.gmane.org>
@ 2022-08-22  7:52       ` Feng Tang
  0 siblings, 0 replies; 3+ messages in thread
From: Feng Tang @ 2022-08-22  7:52 UTC (permalink / raw)
  To: Tejun Heo; +Cc: Zefan Li, Johannes Weiner, cgroups-u79uwXL29TY76Z2rM5mHXA

On Sun, Aug 21, 2022 at 09:30:28PM -1000, Tejun Heo wrote:
> Hello,
> 
> On Sun, Aug 21, 2022 at 03:34:46PM +0800, Feng Tang wrote:
> > 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:
> 
> So, this has been suggested a couple times before and I fully agree that the
> file is really ugly. In the past, we didn't pull the trigger on it for two
> reasons - 1. It is user-visible functional change in that it can break
> really dumb parsers 2. the file is only useful for cgroup1 which has been in
> mostly maintenance mode for many years now. I don't feel that strongly
> either way but still kinda lean towards just leaving it as-is.
 
Ok, makes sense to me. Thanks for the explaination!

Thanks,
Feng


> Thanks.
> 
> -- 
> tejun

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-08-22  7:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-21  7:34 [PATCH] cgroup: cleanup the format of /proc/cgroups Feng Tang
     [not found] ` <20220821073446.92669-1-feng.tang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2022-08-22  7:30   ` Tejun Heo
     [not found]     ` <YwMwlMv/tK3sRXbB-NiLfg/pYEd1N0TnZuCh8vA@public.gmane.org>
2022-08-22  7:52       ` Feng Tang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox