* [Patch v2] cgroup: pretty format /proc/cgroups
@ 2021-11-15 1:12 Wei Yang
2021-11-15 21:21 ` Tejun Heo
2021-11-16 18:00 ` Michal Koutný
0 siblings, 2 replies; 4+ messages in thread
From: Wei Yang @ 2021-11-15 1:12 UTC (permalink / raw)
To: tj, lizefan.x, hannes; +Cc: cgroups, linux-kernel, Wei Yang
Current /proc/cgroups looks like this:
subsys_name hierarchy num_cgroups enabled
cpuset 3 1 1
cpu 2 1 1
cpuacct 2 1 1
memory 4 71 1
freezer 5 1 1
Let's align the title and value. After this patch, it looks like this.
subsys_name hierarchy num_cgroups enabled
cpuset 5 1 1
cpu 3 1 1
cpuacct 3 1 1
memory 2 71 1
freezer 4 1 1
Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
---
v2: the title line is omitted for the start "#"
---
kernel/cgroup/cgroup-v1.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c
index 81c9e0685948..5b177e0eca2c 100644
--- a/kernel/cgroup/cgroup-v1.c
+++ b/kernel/cgroup/cgroup-v1.c
@@ -664,7 +664,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));
--
2.33.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Patch v2] cgroup: pretty format /proc/cgroups
2021-11-15 1:12 [Patch v2] cgroup: pretty format /proc/cgroups Wei Yang
@ 2021-11-15 21:21 ` Tejun Heo
2021-11-16 18:00 ` Michal Koutný
1 sibling, 0 replies; 4+ messages in thread
From: Tejun Heo @ 2021-11-15 21:21 UTC (permalink / raw)
To: Wei Yang; +Cc: lizefan.x, hannes, cgroups, linux-kernel
On Mon, Nov 15, 2021 at 01:12:53AM +0000, Wei Yang wrote:
> Current /proc/cgroups looks like this:
>
> subsys_name hierarchy num_cgroups enabled
> cpuset 3 1 1
> cpu 2 1 1
> cpuacct 2 1 1
> memory 4 71 1
> freezer 5 1 1
>
> Let's align the title and value. After this patch, it looks like this.
>
> subsys_name hierarchy num_cgroups enabled
> cpuset 5 1 1
> cpu 3 1 1
> cpuacct 3 1 1
> memory 2 71 1
> freezer 4 1 1
>
> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
So, I know it's silly but the file is dumb \t formatted (ie. single \t
between fields) and am slightly worried that changing the format might break
some dumb userspace tooling. Given that the information isn't really needed
for cgroup2 anyway, it prolly is better to leave it as-is, I think.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Patch v2] cgroup: pretty format /proc/cgroups
2021-11-15 1:12 [Patch v2] cgroup: pretty format /proc/cgroups Wei Yang
2021-11-15 21:21 ` Tejun Heo
@ 2021-11-16 18:00 ` Michal Koutný
2021-11-17 0:11 ` Wei Yang
1 sibling, 1 reply; 4+ messages in thread
From: Michal Koutný @ 2021-11-16 18:00 UTC (permalink / raw)
To: Wei Yang; +Cc: tj, lizefan.x, hannes, cgroups, linux-kernel
Hello.
On Mon, Nov 15, 2021 at 01:12:53AM +0000, Wei Yang <richard.weiyang@gmail.com> wrote:
> Let's align the title and value. After this patch, it looks like this.
For machines this change may come as a surprise (so better not change
it).
For humans (for instance column from util-linux)
$ column -t /proc/cgroups
#subsys_name hierarchy num_cgroups enabled
cpuset 11 2 1
cpu 4 9 1
cpuacct 4 9 1
...
Michal
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Patch v2] cgroup: pretty format /proc/cgroups
2021-11-16 18:00 ` Michal Koutný
@ 2021-11-17 0:11 ` Wei Yang
0 siblings, 0 replies; 4+ messages in thread
From: Wei Yang @ 2021-11-17 0:11 UTC (permalink / raw)
To: Michal Koutn?; +Cc: Wei Yang, tj, lizefan.x, hannes, cgroups, linux-kernel
On Tue, Nov 16, 2021 at 07:00:17PM +0100, Michal Koutn? wrote:
>Hello.
>
>On Mon, Nov 15, 2021 at 01:12:53AM +0000, Wei Yang <richard.weiyang@gmail.com> wrote:
>> Let's align the title and value. After this patch, it looks like this.
>
>For machines this change may come as a surprise (so better not change
>it).
>
>For humans (for instance column from util-linux)
>
>$ column -t /proc/cgroups
>#subsys_name hierarchy num_cgroups enabled
>cpuset 11 2 1
>cpu 4 9 1
>cpuacct 4 9 1
>...
>
This is helpful, thanks.
>Michal
--
Wei Yang
Help you, Help me
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-11-17 0:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-15 1:12 [Patch v2] cgroup: pretty format /proc/cgroups Wei Yang
2021-11-15 21:21 ` Tejun Heo
2021-11-16 18:00 ` Michal Koutný
2021-11-17 0:11 ` Wei Yang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®