public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: mingo@kernel.org, hpa@zytor.com, linux-kernel@vger.kernel.org,
	torvalds@linux-foundation.org, shai@scalemp.com,
	akpm@linux-foundation.org, tglx@linutronix.de, ido@wizery.com
Cc: 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 19:24:03 +0200	[thread overview]
Message-ID: <1339003443.23343.6.camel@twins> (raw)
In-Reply-To: <tip-d2956406fb61e15ad2b47eda823288db4996acf1@git.kernel.org>

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).

[ and yes I hate those jump_label names ... but I'm not wanting
  to go through another round of bike-shed painting. ]

  reply	other threads:[~2012-06-06 17:24 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 [this message]
2012-06-06 17:41       ` Ingo Molnar
2012-06-06 18:58       ` H. Peter Anvin
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=1339003443.23343.6.camel@twins \
    --to=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=hpa@zytor.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox