From: Ken Chen <kenchen@google.com>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [patch 2/2] cpuacct: export percpu cpuacct cgroup stats
Date: Mon, 15 Dec 2008 23:06:41 -0800 [thread overview]
Message-ID: <b040c32a0812152306p6b72e1d6r548daa66f27f24d6@mail.gmail.com> (raw)
In-Reply-To: <b040c32a0812152204x3b3d378aie7a1898aa67c4278@mail.gmail.com>
sorry, forgot to cc lkml on initial post.
---------- Forwarded message ----------
From: Ken Chen <kenchen@google.com>
Date: Mon, Dec 15, 2008 at 10:04 PM
Subject: [patch 2/2] cpuacct: export percpu cpuacct cgroup stats
To: Ingo Molnar <mingo@elte.hu>, Andrew Morton
<akpm@linux-foundation.org>, Paul Menage <menage@google.com>, Li Zefan
<lizf@cn.fujitsu.com>
This patch export per-cpu CPU cycle usage for a given cpuacct cgroup.
There is a need for a user space monitor daemon to track group CPU
usage on per-cpu base. It is also useful for monitoring CFS load
balancer behavior by tracking per CPU group usage.
Signed-off-by: Ken Chen <kenchen@google.com>
Reviewed-by: Li Zefan <lizf@cn.fujitsu.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
diff --git a/kernel/sched.c b/kernel/sched.c
index 124bd7a..cfdaace 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -9369,12 +9369,32 @@ out:
return err;
}
+static int cpuacct_percpu_seq_read(struct cgroup *cgroup, struct cftype *cft,
+ struct seq_file *m)
+{
+ struct cpuacct *ca = cgroup_ca(cgroup);
+ u64 percpu;
+ int i;
+
+ for_each_present_cpu(i) {
+ percpu = cpuacct_cpuusage_read(ca, i);
+ seq_printf(m, "%llu ", (unsigned long long) percpu);
+ }
+ seq_printf(m, "\n");
+ return 0;
+}
+
static struct cftype files[] = {
{
.name = "usage",
.read_u64 = cpuusage_read,
.write_u64 = cpuusage_write,
},
+ {
+ .name = "usage_percpu",
+ .read_seq_string = cpuacct_percpu_seq_read,
+ },
+
};
static int cpuacct_populate(struct cgroup_subsys *ss, struct cgroup *cgrp)
next parent reply other threads:[~2008-12-16 7:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <b040c32a0812152204x3b3d378aie7a1898aa67c4278@mail.gmail.com>
2008-12-16 7:06 ` Ken Chen [this message]
2008-12-16 11:15 ` Ingo Molnar
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=b040c32a0812152306p6b72e1d6r548daa66f27f24d6@mail.gmail.com \
--to=kenchen@google.com \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®