All of lore.kernel.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: mingo@kernel.org, linux-kernel@vger.kernel.org,
	torvalds@linux-foundation.org, shai@scalemp.com,
	akpm@linux-foundation.org, tglx@linutronix.de, ido@wizery.com,
	linux-tip-commits@vger.kernel.org
Subject: Re: [tip:x86/mm] x86/pat: Avoid contention on cpa_lock if possible
Date: Wed, 06 Jun 2012 11:58:38 -0700	[thread overview]
Message-ID: <4FCFA85E.9010101@zytor.com> (raw)
In-Reply-To: <1339003443.23343.6.camel@twins>

On 06/06/2012 10:24 AM, Peter Zijlstra wrote:
> On Wed, 2012-06-06 at 09:18 -0700, tip-bot for Shai Fultheim wrote:
> 
>> [ I absolutely hate these locking patterns ... yet I have no better idea. Maybe the gents on Cc: ... ]
>> Signed-off-by: Ingo Molnar <mingo@kernel.org>
> 
> Oh yuck, this is vile..
> 
> static struct static_key scale_mp_trainwreck = STATIC_KEY_INIT_FALSE;
> 
> static DEFINE_SPINLOCK(_cpa_lock);
> 
> static inline void cpa_lock(void)
> {
> 	if (static_key_false(&scale_mp_trainwreck))
> 		return;
> 
> 	spin_lock(&_cpa_lock);
> }
> 
> static inline void cpa_unlock(void)
> {
> 	if (static_key_false(&scale_mp_trainwreck))
> 		return;
> 
> 	spin_lock(&_cpa_lock);
> }
> 
> And then use cpa_{,un}lock(), and the scale-mp guys can
> static_key_slow_inc(&scale_mp_trainwreck).
> 

Actually, for this particular subcase I would use a synthetic CPUID bit
and use static_cpu_has().

	-hpa

-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.


  parent reply	other threads:[~2012-06-06 18:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-06 12:40 [PATCH] x86: Avoid contention on cpa_lock if possible Ido Yariv
2012-04-19 22:11 ` [PATCH RESEND] " Ido Yariv
2012-05-05 23:49   ` Ido Yariv
2012-06-02 18:56   ` Ido Yariv
2012-06-06 16:18   ` [tip:x86/mm] x86/pat: " tip-bot for Shai Fultheim
2012-06-06 17:24     ` Peter Zijlstra
2012-06-06 17:41       ` Ingo Molnar
2012-06-06 18:58       ` H. Peter Anvin [this message]
2012-06-06 22:18       ` Shai Fultheim (Shai@ScaleMP.com)
2012-06-06 23:05         ` Ido Yariv
2012-06-06 23:07           ` Shai Fultheim (Shai@ScaleMP.com)

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=4FCFA85E.9010101@zytor.com \
    --to=hpa@zytor.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=ido@wizery.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=shai@scalemp.com \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.