* [PATCH] cgroup: pretty format of /proc/cgoups stats showing
@ 2014-07-02 8:24 chai wen
[not found] ` <1404289478-5554-1-git-send-email-chaiw.fnst-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: chai wen @ 2014-07-02 8:24 UTC (permalink / raw)
To: lizefan-hv44wF8Li93QT0dZR+AlfA, tj-DgEjT+Ai2ygdnm+yROfE0A
Cc: cgroups-u79uwXL29TY76Z2rM5mHXA, chai wen
Just make /proc/cgroups have a better appearance, the original is a little
misleading as its print format.
Before:
#subsys_name hierarchy num_cgroups enabled
cpuset 0 1 1
cpu 0 1 1
cpuacct 0 1 1
devices 0 1 1
freezer 0 1 1
net_cls 0 1 1
blkio 0 1 1
perf_event 0 1 1
After:
#subsys_name hierarchy num_groups enabled
cpuset 0 1 1
cpu 0 1 1
cpuacct 0 1 1
devices 0 1 1
freezer 0 1 1
net_cls 0 1 1
blkio 0 1 1
perf_event 0 1 1
Signed-off-by: chai wen <chaiw.fnst-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
---
kernel/cgroup.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 7868fc3..54c839e 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -4883,7 +4883,8 @@ static 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, "%-18s %-18s %-18s %-18s\n", "#subsys_name", "hierarchy",
+ "num_groups", "enabled");
/*
* ideally we don't want subsystems moving around while we do this.
* cgroup_mutex is also necessary to guarantee an atomic snapshot of
@@ -4892,7 +4893,7 @@ static int proc_cgroupstats_show(struct seq_file *m, void *v)
mutex_lock(&cgroup_mutex);
for_each_subsys(ss, i)
- seq_printf(m, "%s\t%d\t%d\t%d\n",
+ seq_printf(m, "%-18s %-18d %-18d %-18d\n",
ss->name, ss->root->hierarchy_id,
atomic_read(&ss->root->nr_cgrps), !ss->disabled);
--
1.7.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] cgroup: pretty format of /proc/cgoups stats showing
[not found] ` <1404289478-5554-1-git-send-email-chaiw.fnst-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
@ 2014-07-02 8:47 ` Li Zefan
[not found] ` <53B3C712.1090807-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Li Zefan @ 2014-07-02 8:47 UTC (permalink / raw)
To: chai wen; +Cc: tj-DgEjT+Ai2ygdnm+yROfE0A, cgroups-u79uwXL29TY76Z2rM5mHXA
On 2014/7/2 16:24, chai wen wrote:
> Just make /proc/cgroups have a better appearance, the original is a little
> misleading as its print format.
>
> Before:
> #subsys_name hierarchy num_cgroups enabled
> cpuset 0 1 1
> cpu 0 1 1
> cpuacct 0 1 1
> devices 0 1 1
> freezer 0 1 1
> net_cls 0 1 1
> blkio 0 1 1
> perf_event 0 1 1
>
> After:
> #subsys_name hierarchy num_groups enabled
> cpuset 0 1 1
> cpu 0 1 1
> cpuacct 0 1 1
> devices 0 1 1
> freezer 0 1 1
> net_cls 0 1 1
> blkio 0 1 1
> perf_event 0 1 1
>
>
> Signed-off-by: chai wen <chaiw.fnst-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
Someone posted a similar patch long ago, and it was rejected, because
there may be userspace programs/scripts depending on the current format,
and this change will break them.
> ---
> kernel/cgroup.c | 5 +++--
> 1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/cgroup.c b/kernel/cgroup.c
> index 7868fc3..54c839e 100644
> --- a/kernel/cgroup.c
> +++ b/kernel/cgroup.c
> @@ -4883,7 +4883,8 @@ static 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, "%-18s %-18s %-18s %-18s\n", "#subsys_name", "hierarchy",
> + "num_groups", "enabled");
> /*
> * ideally we don't want subsystems moving around while we do this.
> * cgroup_mutex is also necessary to guarantee an atomic snapshot of
> @@ -4892,7 +4893,7 @@ static int proc_cgroupstats_show(struct seq_file *m, void *v)
> mutex_lock(&cgroup_mutex);
>
> for_each_subsys(ss, i)
> - seq_printf(m, "%s\t%d\t%d\t%d\n",
> + seq_printf(m, "%-18s %-18d %-18d %-18d\n",
> ss->name, ss->root->hierarchy_id,
> atomic_read(&ss->root->nr_cgrps), !ss->disabled);
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] cgroup: pretty format of /proc/cgoups stats showing
[not found] ` <53B3C712.1090807-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
@ 2014-07-02 8:52 ` Chai Wen
0 siblings, 0 replies; 3+ messages in thread
From: Chai Wen @ 2014-07-02 8:52 UTC (permalink / raw)
To: Li Zefan; +Cc: tj-DgEjT+Ai2ygdnm+yROfE0A, cgroups-u79uwXL29TY76Z2rM5mHXA
On 07/02/2014 04:47 PM, Li Zefan wrote:
> On 2014/7/2 16:24, chai wen wrote:
>> Just make /proc/cgroups have a better appearance, the original is a little
>> misleading as its print format.
>>
>> Before:
>> #subsys_name hierarchy num_cgroups enabled
>> cpuset 0 1 1
>> cpu 0 1 1
>> cpuacct 0 1 1
>> devices 0 1 1
>> freezer 0 1 1
>> net_cls 0 1 1
>> blkio 0 1 1
>> perf_event 0 1 1
>>
>> After:
>> #subsys_name hierarchy num_groups enabled
>> cpuset 0 1 1
>> cpu 0 1 1
>> cpuacct 0 1 1
>> devices 0 1 1
>> freezer 0 1 1
>> net_cls 0 1 1
>> blkio 0 1 1
>> perf_event 0 1 1
>>
>>
>> Signed-off-by: chai wen <chaiw.fnst-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
>
> Someone posted a similar patch long ago, and it was rejected, because
> there may be userspace programs/scripts depending on the current format,
> and this change will break them.
OK, it's reasonable at that point.
thanks
chai wen
>
>> ---
>> kernel/cgroup.c | 5 +++--
>> 1 files changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/kernel/cgroup.c b/kernel/cgroup.c
>> index 7868fc3..54c839e 100644
>> --- a/kernel/cgroup.c
>> +++ b/kernel/cgroup.c
>> @@ -4883,7 +4883,8 @@ static 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, "%-18s %-18s %-18s %-18s\n", "#subsys_name", "hierarchy",
>> + "num_groups", "enabled");
>> /*
>> * ideally we don't want subsystems moving around while we do this.
>> * cgroup_mutex is also necessary to guarantee an atomic snapshot of
>> @@ -4892,7 +4893,7 @@ static int proc_cgroupstats_show(struct seq_file *m, void *v)
>> mutex_lock(&cgroup_mutex);
>>
>> for_each_subsys(ss, i)
>> - seq_printf(m, "%s\t%d\t%d\t%d\n",
>> + seq_printf(m, "%-18s %-18d %-18d %-18d\n",
>> ss->name, ss->root->hierarchy_id,
>> atomic_read(&ss->root->nr_cgrps), !ss->disabled);
>>
>>
>
> .
>
--
Regards
Chai Wen
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-07-02 8:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-02 8:24 [PATCH] cgroup: pretty format of /proc/cgoups stats showing chai wen
[not found] ` <1404289478-5554-1-git-send-email-chaiw.fnst-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2014-07-02 8:47 ` Li Zefan
[not found] ` <53B3C712.1090807-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2014-07-02 8:52 ` Chai Wen
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.