* [PATCH] cgroup: make cgroups info more readable
@ 2024-04-09 2:18 Huan Yang
2024-04-19 3:33 ` xiujianfeng
0 siblings, 1 reply; 5+ messages in thread
From: Huan Yang @ 2024-04-09 2:18 UTC (permalink / raw)
To: Tejun Heo, Zefan Li, Johannes Weiner, cgroups, linux-kernel
Cc: opensource.kernel, Huan Yang
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] cgroup: make cgroups info more readable
2024-04-09 2:18 [PATCH] cgroup: make cgroups info more readable Huan Yang
@ 2024-04-19 3:33 ` xiujianfeng
2024-04-19 6:25 ` Huan Yang
0 siblings, 1 reply; 5+ messages in thread
From: xiujianfeng @ 2024-04-19 3:33 UTC (permalink / raw)
To: Huan Yang, Tejun Heo, Zefan Li, Johannes Weiner, cgroups, linux-kernel
Cc: opensource.kernel
Hi,
I found a discussion about this change in the email thread bellow, and
hope it helps you.
https://lore.kernel.org/all/YwMwlMv%2FtK3sRXbB@slm.duckdns.org/#t
On 2024/4/9 10:18, Huan Yang wrote:
> 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));
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] cgroup: make cgroups info more readable
2024-04-19 3:33 ` xiujianfeng
@ 2024-04-19 6:25 ` Huan Yang
2024-04-20 2:47 ` xiujianfeng
0 siblings, 1 reply; 5+ messages in thread
From: Huan Yang @ 2024-04-19 6:25 UTC (permalink / raw)
To: xiujianfeng, Huan Yang, Tejun Heo, Zefan Li, Johannes Weiner,
cgroups, linux-kernel
Cc: opensource.kernel
HI jianfeng
在 2024/4/19 11:33, xiujianfeng 写道:
> [Some people who received this message don't often get email from xiujianfeng@huawei.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> Hi,
>
> I found a discussion about this change in the email thread bellow, and
> hope it helps you.
It's helpful to know why this patch not need, thank you.
>
> https://lore.kernel.org/all/YwMwlMv%2FtK3sRXbB@slm.duckdns.org/#t
I have a question, that, now that only for cgroup1, when I running qemu
ubuntu, I got this:
> mount | grep cgroup
> cgroup2 on /sys/fs/cgroup type cgroup2
(rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot)
Only cgroup2 mount in my system, but /proc/cgroup also worked, maybe
better to disable this when only cgroup2 mounted?
> On 2024/4/9 10:18, Huan Yang wrote:
>> 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));
>>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] cgroup: make cgroups info more readable
2024-04-19 6:25 ` Huan Yang
@ 2024-04-20 2:47 ` xiujianfeng
2024-04-22 1:37 ` Huan Yang
0 siblings, 1 reply; 5+ messages in thread
From: xiujianfeng @ 2024-04-20 2:47 UTC (permalink / raw)
To: Huan Yang, Huan Yang, Tejun Heo, Zefan Li, Johannes Weiner,
cgroups, linux-kernel
Cc: opensource.kernel
Hi,
On 2024/4/19 14:25, Huan Yang wrote:
> HI jianfeng
>
> 在 2024/4/19 11:33, xiujianfeng 写道:
>> [Some people who received this message don't often get email from
>> xiujianfeng@huawei.com. Learn why this is important at
>> https://aka.ms/LearnAboutSenderIdentification ]
>>
>> Hi,
>>
>> I found a discussion about this change in the email thread bellow, and
>> hope it helps you.
> It's helpful to know why this patch not need, thank you.
>>
>> https://lore.kernel.org/all/YwMwlMv%2FtK3sRXbB@slm.duckdns.org/#t
>
> I have a question, that, now that only for cgroup1, when I running qemu
> ubuntu, I got this:
>
>> mount | grep cgroup
>> cgroup2 on /sys/fs/cgroup type cgroup2
> (rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot)
>
> Only cgroup2 mount in my system, but /proc/cgroup also worked, maybe
> better to disable this when only cgroup2 mounted?
I’m not the maintainer, so the official answer to this question should
be left to them:).
However, I don’t think this is the right way. Even though the
information shown by /proc/cgroups doesn’t seem as useful for cgroup2 as
for cgroup1 due to cgroup2 has only single hierarchy, it’s not entirely
useless, IMHO.
>
>> On 2024/4/9 10:18, Huan Yang wrote:
>>> 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));
>>>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] cgroup: make cgroups info more readable
2024-04-20 2:47 ` xiujianfeng
@ 2024-04-22 1:37 ` Huan Yang
0 siblings, 0 replies; 5+ messages in thread
From: Huan Yang @ 2024-04-22 1:37 UTC (permalink / raw)
To: xiujianfeng, Huan Yang, Tejun Heo, Zefan Li, Johannes Weiner,
cgroups, linux-kernel
Cc: opensource.kernel
在 2024/4/20 10:47, xiujianfeng 写道:
> However, I don’t think this is the right way. Even though the
> information shown by /proc/cgroups doesn’t seem as useful for cgroup2 as
> for cgroup1 due to cgroup2 has only single hierarchy, it’s not entirely
OK, thanks for your reply
> useless, IMHO.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-04-22 1:37 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-09 2:18 [PATCH] cgroup: make cgroups info more readable Huan Yang
2024-04-19 3:33 ` xiujianfeng
2024-04-19 6:25 ` Huan Yang
2024-04-20 2:47 ` xiujianfeng
2024-04-22 1:37 ` Huan 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®