* [PATCH] cgroup-v1: use find granularity format identifiers to make /proc/cgroups show pretty
@ 2022-06-30 8:25 ` Lin Feng
0 siblings, 0 replies; 6+ messages in thread
From: Lin Feng @ 2022-06-30 8:25 UTC (permalink / raw)
To: tj, lizefan.x, hannes; +Cc: cgroups, linux-kernel, linf
The listing subsys info is unaligned with the header columns and we can
make the output more intuitive to read by specifying "left alignment"
and "fixed length" format styles for seq_printf.
# cat /proc/cgroups
the output originally:
#subsys_name hierarchy num_cgroups enabled
cpuset 11 19 1
cpu 5 122 1
cpuacct 5 122 1
blkio 4 122 1
memory 10 129 1
devices 6 122 1
freezer 9 19 1
net_cls 8 19 1
perf_event 3 19 1
net_prio 8 19 1
hugetlb 7 19 1
pids 12 122 1
rdma 2 1 1
output after this patch:
#subsys_name hierarchy num_cgroups enabled
cpuset 11 19 1
cpu 5 122 1
cpuacct 5 122 1
blkio 4 122 1
memory 10 129 1
devices 6 122 1
freezer 9 19 1
net_cls 8 19 1
perf_event 3 19 1
net_prio 8 19 1
hugetlb 7 19 1
pids 12 122 1
rdma 2 1 1
Signed-off-by: Lin Feng <linf@wangsu.com>
---
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 afc6c0e9c966..1a74b0c504aa 100644
--- a/kernel/cgroup/cgroup-v1.c
+++ b/kernel/cgroup/cgroup-v1.c
@@ -677,7 +677,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%-10d\t%-10d\t%-d\n",
ss->legacy_name, ss->root->hierarchy_id,
atomic_read(&ss->root->nr_cgrps),
cgroup_ssid_enabled(i));
--
2.31.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] cgroup-v1: use find granularity format identifiers to make /proc/cgroups show pretty
@ 2022-06-30 8:25 ` Lin Feng
0 siblings, 0 replies; 6+ messages in thread
From: Lin Feng @ 2022-06-30 8:25 UTC (permalink / raw)
To: tj-DgEjT+Ai2ygdnm+yROfE0A, lizefan.x-EC8Uxl6Npydl57MIdRCFDg,
hannes-druUgvl0LCNAfugRpC6u6w
Cc: cgroups-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, linf-VqLewplIU37QT0dZR+AlfA
The listing subsys info is unaligned with the header columns and we can
make the output more intuitive to read by specifying "left alignment"
and "fixed length" format styles for seq_printf.
# cat /proc/cgroups
the output originally:
#subsys_name hierarchy num_cgroups enabled
cpuset 11 19 1
cpu 5 122 1
cpuacct 5 122 1
blkio 4 122 1
memory 10 129 1
devices 6 122 1
freezer 9 19 1
net_cls 8 19 1
perf_event 3 19 1
net_prio 8 19 1
hugetlb 7 19 1
pids 12 122 1
rdma 2 1 1
output after this patch:
#subsys_name hierarchy num_cgroups enabled
cpuset 11 19 1
cpu 5 122 1
cpuacct 5 122 1
blkio 4 122 1
memory 10 129 1
devices 6 122 1
freezer 9 19 1
net_cls 8 19 1
perf_event 3 19 1
net_prio 8 19 1
hugetlb 7 19 1
pids 12 122 1
rdma 2 1 1
Signed-off-by: Lin Feng <linf-VqLewplIU37QT0dZR+AlfA@public.gmane.org>
---
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 afc6c0e9c966..1a74b0c504aa 100644
--- a/kernel/cgroup/cgroup-v1.c
+++ b/kernel/cgroup/cgroup-v1.c
@@ -677,7 +677,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%-10d\t%-10d\t%-d\n",
ss->legacy_name, ss->root->hierarchy_id,
atomic_read(&ss->root->nr_cgrps),
cgroup_ssid_enabled(i));
--
2.31.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] cgroup-v1: use find granularity format identifiers to make /proc/cgroups show pretty
@ 2022-07-01 1:09 ` Tejun Heo
0 siblings, 0 replies; 6+ messages in thread
From: Tejun Heo @ 2022-07-01 1:09 UTC (permalink / raw)
To: Lin Feng; +Cc: lizefan.x, hannes, cgroups, linux-kernel
On Thu, Jun 30, 2022 at 04:25:39PM +0800, Lin Feng wrote:
> The listing subsys info is unaligned with the header columns and we can
> make the output more intuitive to read by specifying "left alignment"
> and "fixed length" format styles for seq_printf.
This has been proposed before but the file is useful only in cgroup1
which is in maintenance mode and the format has been like that since
forever. Given that there's some chance that it can break dumb
parsers, the choice has been to leave it alone. It's such a dumb file
format to begin with and just leaving it to wither and die seems to be
the right direction.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] cgroup-v1: use find granularity format identifiers to make /proc/cgroups show pretty
@ 2022-07-01 1:09 ` Tejun Heo
0 siblings, 0 replies; 6+ messages in thread
From: Tejun Heo @ 2022-07-01 1:09 UTC (permalink / raw)
To: Lin Feng
Cc: lizefan.x-EC8Uxl6Npydl57MIdRCFDg, hannes-druUgvl0LCNAfugRpC6u6w,
cgroups-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
On Thu, Jun 30, 2022 at 04:25:39PM +0800, Lin Feng wrote:
> The listing subsys info is unaligned with the header columns and we can
> make the output more intuitive to read by specifying "left alignment"
> and "fixed length" format styles for seq_printf.
This has been proposed before but the file is useful only in cgroup1
which is in maintenance mode and the format has been like that since
forever. Given that there's some chance that it can break dumb
parsers, the choice has been to leave it alone. It's such a dumb file
format to begin with and just leaving it to wither and die seems to be
the right direction.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] cgroup-v1: use find granularity format identifiers to make /proc/cgroups show pretty
@ 2022-07-01 1:49 ` Lin Feng
0 siblings, 0 replies; 6+ messages in thread
From: Lin Feng @ 2022-07-01 1:49 UTC (permalink / raw)
To: Tejun Heo; +Cc: lizefan.x, hannes, cgroups, linux-kernel
Hi Tejun,
On 7/1/22 09:09, Tejun Heo wrote:
> On Thu, Jun 30, 2022 at 04:25:39PM +0800, Lin Feng wrote:
>> The listing subsys info is unaligned with the header columns and we can
>> make the output more intuitive to read by specifying "left alignment"
>> and "fixed length" format styles for seq_printf.
> This has been proposed before but the file is useful only in cgroup1
> which is in maintenance mode and the format has been like that since
> forever. Given that there's some chance that it can break dumb
> parsers, the choice has been to leave it alone. It's such a dumb file
> format to begin with and just leaving it to wither and die seems to be
> the right direction.
Thanks for your explanation and sorry that I missed we have such a consensus
before.
I had considered that if this change would break the parsers, but it's likely
that it won't else the parser is really a broken one and needs some improvements.
On the other hand, cgroup-v1 still has many old users and kernel still has to
maintain it for some time for back compatible reason, so I think this tiny fix
should not be a bad idea.
Thanks,
linfeng
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] cgroup-v1: use find granularity format identifiers to make /proc/cgroups show pretty
@ 2022-07-01 1:49 ` Lin Feng
0 siblings, 0 replies; 6+ messages in thread
From: Lin Feng @ 2022-07-01 1:49 UTC (permalink / raw)
To: Tejun Heo
Cc: lizefan.x-EC8Uxl6Npydl57MIdRCFDg, hannes-druUgvl0LCNAfugRpC6u6w,
cgroups-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
Hi Tejun,
On 7/1/22 09:09, Tejun Heo wrote:
> On Thu, Jun 30, 2022 at 04:25:39PM +0800, Lin Feng wrote:
>> The listing subsys info is unaligned with the header columns and we can
>> make the output more intuitive to read by specifying "left alignment"
>> and "fixed length" format styles for seq_printf.
> This has been proposed before but the file is useful only in cgroup1
> which is in maintenance mode and the format has been like that since
> forever. Given that there's some chance that it can break dumb
> parsers, the choice has been to leave it alone. It's such a dumb file
> format to begin with and just leaving it to wither and die seems to be
> the right direction.
Thanks for your explanation and sorry that I missed we have such a consensus
before.
I had considered that if this change would break the parsers, but it's likely
that it won't else the parser is really a broken one and needs some improvements.
On the other hand, cgroup-v1 still has many old users and kernel still has to
maintain it for some time for back compatible reason, so I think this tiny fix
should not be a bad idea.
Thanks,
linfeng
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-07-01 1:50 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-30 8:25 [PATCH] cgroup-v1: use find granularity format identifiers to make /proc/cgroups show pretty Lin Feng
2022-06-30 8:25 ` Lin Feng
2022-07-01 1:09 ` Tejun Heo
2022-07-01 1:09 ` Tejun Heo
2022-07-01 1:49 ` Lin Feng
2022-07-01 1:49 ` Lin Feng
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.