From: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
To: chai wen <chaiw.fnst-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
Cc: tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] cgroup: pretty format of /proc/cgoups stats showing
Date: Wed, 2 Jul 2014 16:47:14 +0800 [thread overview]
Message-ID: <53B3C712.1090807@huawei.com> (raw)
In-Reply-To: <1404289478-5554-1-git-send-email-chaiw.fnst-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
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);
>
>
next prev parent reply other threads:[~2014-07-02 8:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
[not found] ` <53B3C712.1090807-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2014-07-02 8:52 ` Chai Wen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53B3C712.1090807@huawei.com \
--to=lizefan-hv44wf8li93qt0dzr+alfa@public.gmane.org \
--cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=chaiw.fnst-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org \
--cc=tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox