From: Paul Mackerras <paulus@samba.org>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>,
linux-kernel@vger.kernel.org,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH] perfcounters: Make s/w counters in a group only count when group is on
Date: Mon, 16 Mar 2009 21:33:30 +1100 [thread overview]
Message-ID: <18878.11002.809624.875621@cargo.ozlabs.ibm.com> (raw)
In-Reply-To: <1237197403.7818.30.camel@twins>
Peter Zijlstra writes:
> > So... I was about to restore that symmetry by implementing lazy PMU
> > context switching. In the case where we have inherited counters, and
> > we are switching from one task to another that both have the same set
> > of inherited counters, we don't really need to do anything, because it
> > doesn't matter which set of counters the events get added into,
> > because they all get added together at the end anyway.
>
> That is only true for actual counting counters, not the sampling kind.
Hmmm... I don't think inherited sampling counters work at present
anyway. :) The events for a child process will go into the child
struct perf_counter, and the code doesn't currently provide any way to
read them out (unless I missed something).
> > It seems quite reasonable to me that things could happen that are
> > attributable to a task, but which happen when the task isn't running.
> > Not just context switches and migrations - there's a whole class of
> > things that the system does on behalf of a process that can happen
> > asynchronously. I wouldn't want to say that those kind of things can
> > never be counted with software counters.
>
> I've been thinking too much about sampling I think. It makes absolutely
> no sense in that light to have events that occur when the task isn't
> running, quite simply because its impossible to relate it to whatever
> the task is doing at that moment.
>
> However for simple counting events it might make sense to have something
> like that.
>
> Still HW counters can simply never do anything like that, and the lazy
> PMU thing you propose, while cool for simple stuff like perfstat, is
> something all-together different -- it doesn't keep counters enabled
> while their task is gone from the cpu, it avoids a counter update
> between related tasks.
As an implementation detail, I think we could get the situation where
a counter is active but its task isn't running in two cases: software
counters that count while their task is switched out, and hardware
counters that have been lazily left running past a context switch.
I was trying to handle both cases in a similar manner.
However, your new software counter code seems to be doing the right
thing with a task clock counter in a group that also has a hardware
counter, so my patch is no longer required. But, I notice that the
counter->prev_state thing is still there. It would be nice to get rid
of that.
Paul.
prev parent reply other threads:[~2009-03-16 10:33 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-13 1:59 Paul Mackerras
2009-03-13 10:23 ` Peter Zijlstra
2009-03-13 12:23 ` Paul Mackerras
2009-03-13 12:44 ` Peter Zijlstra
2009-03-13 13:04 ` Peter Zijlstra
2009-03-13 13:13 ` Ingo Molnar
2009-03-13 23:43 ` Paul Mackerras
2009-03-13 22:41 ` Paul Mackerras
2009-03-14 11:51 ` Ingo Molnar
2009-03-16 9:56 ` Peter Zijlstra
2009-03-16 10:33 ` Paul Mackerras [this message]
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=18878.11002.809624.875621@cargo.ozlabs.ibm.com \
--to=paulus@samba.org \
--cc=a.p.zijlstra@chello.nl \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
/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®