From: Li Zefan <lizf@cn.fujitsu.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: eranian@google.com, linux-kernel@vger.kernel.org, mingo@elte.hu,
paulus@samba.org, davem@davemloft.net, fweisbec@gmail.com,
perfmon2-devel@lists.sf.net, eranian@gmail.com,
robert.richter@amd.com, acme@redhat.com,
Paul Menage <menage@google.com>, Balbir Singh <balbir@in.ibm.com>,
Greg Kroah-Hartman <gregkh@suse.de>
Subject: Re: [PATCH 1/2] perf_events: add support for per-cpu per-cgroup monitoring (v5)
Date: Fri, 26 Nov 2010 09:50:24 +0800 [thread overview]
Message-ID: <4CEF1260.4000009@cn.fujitsu.com> (raw)
In-Reply-To: <1290684523.2145.31.camel@laptop>
19:28, Peter Zijlstra wrote:
> On Thu, 2010-11-18 at 12:40 +0200, Stephane Eranian wrote:
>> This kernel patch adds the ability to filter monitoring based on
>> container groups (cgroups). This is for use in per-cpu mode only.
>>
>> The cgroup to monitor is passed as a file descriptor in the pid
>> argument to the syscall. The file descriptor must be opened to
>> the cgroup name in the cgroup filesystem. For instance, if the
>> cgroup name is foo and cgroupfs is mounted in /cgroup, then the
>> file descriptor is opened to /cgroup/foo. Cgroup mode is
>> activated by passing PERF_FLAG_PID_CGROUP in the flags argument
>> to the syscall.
>>
>> For instance to measure in cgroup foo on CPU1 assuming
>> cgroupfs is mounted under /cgroup:
>>
>> struct perf_event_attr attr;
>> int cgroup_fd, fd;
>>
>> cgroup_fd = open("/cgroup/foo", O_RDONLY);
>> fd = perf_event_open(&attr, cgroup_fd, 1, -1, PERF_FLAG_PID_CGROUP);
>> close(cgroup_fd);
>>
>> Signed-off-by: Stephane Eranian <eranian@google.com>
>
> Could you please split this patch:
> - pure code movement
> - time accounting changes
> - event_filter_match() stuff
> - cgroup thing
>
> From a quick reading it doesn't look bad, but I want an ACK from the
> cgroup people -- specifically if they're OK with the filedesc juggling
> thing, because I know the sysfs people objected to such tricks.
>
Long long ago, a feature that used this trick was accepted, and that's
cgroup taskstat.
You get an fd of a cgroup directory and send it to the kernel via netlink,
and then you'll receive some statistics, such as how many tasks are
running/interrupted in that cgroup.
> Also, it might make sense to add a CONFIG_PERF_CGROUP, even if you want
> it automagically set if CONFIG_PERF && CONFIG_CGROUP, its easier to find
> all related code if its under a single CONFIG_var.
>
next prev parent reply other threads:[~2010-11-26 1:48 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-18 10:40 [PATCH 1/2] perf_events: add support for per-cpu per-cgroup monitoring (v5) Stephane Eranian
2010-11-25 11:20 ` Peter Zijlstra
2010-11-25 14:53 ` Stephane Eranian
[not found] ` <AANLkTi=J8eRKjb8BBsDjaxnsvvuSLbZw2CN4k3YFGM+Y@mail.gmail.com>
2010-11-25 15:02 ` Peter Zijlstra
2010-11-25 21:32 ` Stephane Eranian
2010-11-26 11:16 ` Peter Zijlstra
2010-11-25 11:28 ` Peter Zijlstra
2010-11-26 1:50 ` Li Zefan [this message]
2010-11-26 2:56 ` Balbir Singh
2010-11-26 8:28 ` Li Zefan
2010-11-26 11:28 ` Peter Zijlstra
2010-11-26 11:17 ` Peter Zijlstra
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=4CEF1260.4000009@cn.fujitsu.com \
--to=lizf@cn.fujitsu.com \
--cc=acme@redhat.com \
--cc=balbir@in.ibm.com \
--cc=davem@davemloft.net \
--cc=eranian@gmail.com \
--cc=eranian@google.com \
--cc=fweisbec@gmail.com \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=menage@google.com \
--cc=mingo@elte.hu \
--cc=paulus@samba.org \
--cc=perfmon2-devel@lists.sf.net \
--cc=peterz@infradead.org \
--cc=robert.richter@amd.com \
/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