public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Stephane Eranian <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 18:27:27 +0200	[thread overview]
Message-ID: <1285086447.2275.887.camel@laptop> (raw)
In-Reply-To: <AANLkTimFgsOkMaX9FFidqL-6SHStgqW6v73F3rM-Kmmz@mail.gmail.com>

On Tue, 2010-09-21 at 18:17 +0200, Stephane Eranian wrote:
> On Tue, Sep 21, 2010 at 4:03 PM, Peter Zijlstra <peterz@infradead.org> wrote:
> > On Tue, 2010-09-21 at 15:38 +0200, Stephane Eranian wrote:
> >> > Hmm, indeed. One thing we can do about that is move perf into the
> >> > cgroup, create the counter (disabled) using self to identify the cgroup,
> >> > move perf back to where it came from, and enable the counter.
> >> >
> >> Yes, that's another possibility. I wonder if there are any non-obvious
> >> difficulties with this approach.
> >
> > Yes, there is, but I think we can fix it. The problem with moving perf
> > itself around is that perf is not a fully dormant process and can thus
> > interact with the cgroup state.
> >
> I was thinking about memory accounting for instance.

I think the memory controller only accounts things when the process
actually touches something. A process that never wakes will never touch
anything.

> > If we were to fork a child that's simply sitting idle in waitpid() (or
> > any other blocking syscall) we can move that around cgroup without
> > affecting the cgroup itself.
> 
> But then things get a bit more complicated because the perf_event_open()
> has to be done in that child. File descriptors created in child processes
> and not shared with their parent. You'd have to pass file descriptors around.
> That seems overly complicated.

Uhm, no the trick is that the child remains absolutely dormant and
therefore doesn't accrue any accounting, all you need is a known task in
the cgroup, the parent can then specify the child pid to identify the
group.

Once you've opened the counter, you can move the kid out and kill it.
Note that moving it out of the cgroup before killing it ensure it never
wakes up inside that cgroup.



  reply	other threads:[~2010-09-21 16:28 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
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 [this message]
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=1285086447.2275.887.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