mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paul Mackerras <paulus@samba.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: linux-kernel@vger.kernel.org, Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [RFC PATCH] perf_counter: Add support for pinned and exclusive counter groups
Date: Thu, 15 Jan 2009 14:34:54 +1100	[thread overview]
Message-ID: <18798.44766.734357.560006@cargo.ozlabs.ibm.com> (raw)
In-Reply-To: <20090114095743.GA1389@elte.hu>

Ingo Molnar writes:

> (btw., the percpu allocation code seems to have bitrotten a bit - the 
> logic around perf_reserved_percpu looks wrong and somewhat complicated.)

Yes, it has.  I don't think it was ever fixed to apply only to
hardware counters when software counters were added.

Side question - were you intending to make the various software
counters able to act as interrupting counters?  That will mean
e.g. that anything that increments current->maj_flt or
current->min_flt (i.e. do_page_fault, __get_user_pages) will need to
check if that causes any counter to overflow, which could be a bit
invasive.

> hm, i guess this could be improved: by queueing pinned counters in front 
> of the list and unpinned counters to the tail.

Yes - and there are other little optimizations we could do too, such
as recording the number of hardware counters in the group leader's
struct perf_counter.

> > What this doesn't handle is when a pinned counter gets inherited and 
> > goes into error state in the child.  The sensible thing would be to put 
> > the parent counter into error state in __perf_counter_exit_task, but 
> > that might mean taking it off the PMU on some other CPU, and I was 
> > nervous about doing anything substantial to parent_counter.  Maybe what 
> > we need instead of an error value for counter->state is a separate error 
> > flag that can be set atomically by exiting children. BTW, I think we 
> > need an smp_wmb after updating parent_counter->count, so that when the 
> > parent sees the child has exited it is guaranteed to see the updated 
> > ->count value.
> 
> Yeah. Such artifacts at inheritance stem from the reduction in utility 
> that comes from any exclusive-resource-usage scheme, and are expected.

Hmmm, I don't see pinning as being about exclusivity, and the reason
my patch didn't handle it was because I haven't completely got my head
around the relevant lifetime and locking rules.

> For example, right now it works just fine to nest 'timec' in itself [there 
> is a reduction in statistical value if we start round-robining, but 
> there's still full utility]. If it used exclusive or pinned counters that 
> might not work.

Should be fine with pinned counters, and even with exclusive counters
as long as the counters are in one group.

> Again, which restrictions users/developers are more willing to live with 
> will be shown in actual usage of these facilities.

Indeed.

Regards,
Paul.

  parent reply	other threads:[~2009-01-15  3:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-14  9:24 Paul Mackerras
2009-01-14  9:57 ` Ingo Molnar
2009-01-14 10:08   ` Ingo Molnar
2009-01-15  3:34   ` Paul Mackerras [this message]
2009-01-15 11:21     ` Ingo Molnar
2009-01-15  2:23 ` Paul Mackerras
2009-01-15 11:21   ` 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=18798.44766.734357.560006@cargo.ozlabs.ibm.com \
    --to=paulus@samba.org \
    --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®