mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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
Subject: Re: [PATCH RFC] perf_counter: Don't swap contexts containing locked mutex
Date: Fri, 29 May 2009 18:25:16 +1000	[thread overview]
Message-ID: <18975.39916.877132.690506@cargo.ozlabs.ibm.com> (raw)
In-Reply-To: <1243584388.23657.156.camel@twins>

Peter Zijlstra writes:

> > -		&& ctx1->parent_gen == ctx2->parent_gen;
> > +		&& ctx1->parent_gen == ctx2->parent_gen
> > +		&& ctx1->parent_gen != ~0ull;
> >  }
> 
> There's a nasty surprise for people a few generations down the line. All
> of a sudden performance drops for a while for some unknown reason, and
> then its good again,.. how odd ;-)

If you can add a counter every microsecond (which I don't think any
current processor can do) it'll still be more than half a million
years before we get that far...

> But yeah, seems fine, given that the alternative is yet another
> variable.

Actually, having a 1-bit flag might be cleaner since we can then just
clear it, rather than having to put the old parent_gen back.

> <snip all the other WARN_ON_ONCEs>
> 
> How about:
> 
> #define ASSERT_CTX_STABLE(ctx) \
>   WARN_ON_ONCE((ctx)->parent_gen != ~0ull || ctx->parent_ctx)
> 
> which would deal with both a 'locked' context and uncloned one?

Yeah, all right.

> Could we maybe write this as:
> 
> static struct perf_counter_ctx *pin_ctx(struct perf_counter *counter, u64 *old_gen)

Yep, good idea.

Paul.

  parent reply	other threads:[~2009-05-29  8:25 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-29  6:06 Paul Mackerras
2009-05-29  8:06 ` Peter Zijlstra
2009-05-29  8:10   ` Peter Zijlstra
2009-05-29  8:13   ` Peter Zijlstra
2009-05-29  8:28     ` Peter Zijlstra
2009-05-29  8:59       ` Ingo Molnar
2009-05-29  9:16         ` Ingo Molnar
2009-05-29 11:13           ` Paul Mackerras
2009-05-29 11:17             ` Peter Zijlstra
2009-05-29 11:23             ` Paul Mackerras
2009-05-29 12:35           ` Ingo Molnar
2009-05-29 13:49             ` Pekka Enberg
2009-05-29  8:25   ` Paul Mackerras [this message]
2009-05-29 12:03 ` [tip:perfcounters/core] " tip-bot for Paul Mackerras

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=18975.39916.877132.690506@cargo.ozlabs.ibm.com \
    --to=paulus@samba.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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®