public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: eranian@google.com
Cc: 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>, Li Zefan <lizf@cn.fujitsu.com>,
	Balbir Singh <balbir@linux.vnet.ibm.com>
Subject: Re: [RFC PATCH 0/2] perf_events: add support for per-cpu per-cgroup monitoring (v3)
Date: Tue, 21 Sep 2010 11:43:48 +0200	[thread overview]
Message-ID: <1285062228.2275.826.camel@laptop> (raw)
In-Reply-To: <1285061899.2275.824.camel@laptop>

On Tue, 2010-09-21 at 11:38 +0200, Peter Zijlstra wrote:
> On Thu, 2010-09-09 at 15:05 +0200, Stephane Eranian wrote:
> > The cgroup to monitor is designated by passing a file descriptor opened
> > on a new per-cgroup file in the cgroup filesystem (perf_event.perf). The
> > option must be activated by setting perf_event_attr.cgroup=1 and passing
> > a valid file descriptor in perf_event_attr.cgroup_fd. Those are the only
> > two ABI extensions. 
> 
> > +++ b/include/linux/perf_event.h
> > @@ -215,8 +215,9 @@ struct perf_event_attr {
> >                                  */
> >                                 precise_ip     :  2, /* skid constraint       */
> >                                 mmap_data      :  1, /* non-exec mmap data    */
> > +                               cgroup         :  1, /* cgroup aggregation    */
> >  
> > -                               __reserved_1   : 46;
> > +                               __reserved_1   : 45;
> >  
> >         union {
> >                 __u32           wakeup_events;    /* wakeup every n events */
> > @@ -226,6 +227,8 @@ struct perf_event_attr {
> >         __u32                   bp_type;
> >         __u64                   bp_addr;
> >         __u64                   bp_len;
> > +
> > +       int                     cgroup_fd;
> >  };
> >  
> >  /*
> 
> I'm not sure I like this much.. so we attach to {pid,cpu}, for nodes we
> can use cpu_to_node(cpu), which would suggest to use
> cgroup_of_task(pid), except that a task can be part of multiple cgroups,
> so its not unique.
> 
> One thing we could do is pass this cgroup identifier in the pid field
> and use PERF_FLAG_CGROUP or something. Currently the syscall signature
> uses pid_t, but I think we can safely change that to int.
> 
> You create a special new file in the cgroup stuff, I'm not sure about
> that either, but its not something I feel too strongly about, why
> wouldn't a fd of any file or even directory of that cgroup work? Do the
> cgroup people have an opinion?

Ahh, I just read more of the patch, and you create a full perf cgroup,
in which case cgroup_of_task(pid) will work, simply pick the perf
cgroup's tasks.

No need to actually create that file, open it and pass fds around, just
pick a task from that cgroup and attach to the cgroup through that.

  reply	other threads:[~2010-09-21  9:44 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-09 13:05 [RFC PATCH 0/2] perf_events: add support for per-cpu per-cgroup monitoring (v3) Stephane Eranian
2010-09-21  9:38 ` Peter Zijlstra
2010-09-21  9:43   ` Peter Zijlstra [this message]
2010-09-21 11:48     ` Stephane Eranian
2010-09-21 12:42       ` Peter Zijlstra
2010-09-21 13:38         ` Stephane Eranian
2010-09-21 14:03           ` Peter Zijlstra
2010-09-21 16:17             ` Stephane Eranian
2010-09-21 16:27               ` Peter Zijlstra
2010-09-21 16:33                 ` Stephane Eranian
2010-09-22  4:34                 ` Balbir Singh
2010-09-22  7:25                   ` Peter Zijlstra
2010-09-22  4:23   ` Balbir Singh
2010-09-22  7:27     ` Peter Zijlstra
2010-09-22  9:18       ` Balbir Singh
2010-09-22 10:26         ` Stephane Eranian
2010-09-25  9:51           ` Peter Zijlstra
2010-09-28  9:23             ` Stephane Eranian

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=1285062228.2275.826.camel@laptop \
    --to=peterz@infradead.org \
    --cc=acme@redhat.com \
    --cc=balbir@linux.vnet.ibm.com \
    --cc=davem@davemloft.net \
    --cc=eranian@gmail.com \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizf@cn.fujitsu.com \
    --cc=menage@google.com \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=perfmon2-devel@lists.sf.net \
    --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