linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Davidlohr Bueso <davidlohr@hp.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	Aswin Chandramouleeswaran <aswin@hp.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] arch,locking: Ciao arch_mutex_cpu_relax()
Date: Tue, 24 Jun 2014 08:06:55 -0700	[thread overview]
Message-ID: <1403622415.15523.4.camel@buesod1.americas.hpqcorp.net> (raw)
In-Reply-To: <20140623065835.GF19860@laptop.programming.kicks-ass.net>

On Mon, 2014-06-23 at 08:58 +0200, Peter Zijlstra wrote:
> On Fri, Jun 20, 2014 at 11:21:13AM -0700, Davidlohr Bueso wrote:
> > From: Davidlohr Bueso <davidlohr@hp.com>
> > 
> > The arch_mutex_cpu_relax() function, introduced by 34b133f, is
> > hacky and ugly. It was added a few years ago to address the fact
> > that common cpu_relax() calls include yielding on s390, and thus
> > impact the optimistic spinning functionality of mutexes. Nowadays
> > we use this function well beyond mutexes: rwsem, qrwlock, mcs and
> > lockref. Since the macro that defines the call is in the mutex header,
> > any users must include mutex.h and the naming is misleading as well.
> > 
> > This patch (i) renames the call to arch_cpu_relax (for lack of a better
> > name), and (ii) defines it in each arch's asm/processor.h local header,
> > just like for regular cpu_relax() functions. On all archs, except s390,
> > arch_cpu_relax is simply cpu_relax, and thus we can take it out of
> > mutex.h. While this can seem redundant or weird, I believe it is a
> > good choice as it allows us to move out arch specific logic from generic
> > locking primitives and enables future(?) archs to transparently define
> > it, similarly to System Z.
> > 
> > Please note that these changes are only tested on x86-64.
> 
> While I like the general idea; does anyone have a better name for this?
> So in particular, the difference is that on s390:
> 
>  cpu_relax()                - yields the vcpu
>  arch_{,mutex_}cpu_relax()  - will actually spin-wait

iirc Heiko had suggested cpu_relax_simple() in the past. I don't think
it's any better or worse than arch_cpu_relax(). For s390
cpu_relax_noyield() would perhaps be suitable, but not very descriptive
for the rest of the archs. I'm really lacking creativity for this name.

Thanks,
Davidlohr



  reply	other threads:[~2014-06-24 15:07 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-20 18:21 [PATCH] arch,locking: Ciao arch_mutex_cpu_relax() Davidlohr Bueso
2014-06-23  6:54 ` Peter Zijlstra
2014-06-23  7:13   ` Vineet Gupta
2014-06-23 11:34     ` Peter Zijlstra
2014-06-23  6:58 ` Peter Zijlstra
2014-06-24 15:06   ` Davidlohr Bueso [this message]
2014-06-25  6:25     ` Heiko Carstens
2014-06-25 11:57       ` Linus Torvalds
2014-06-29 22:09         ` [PATCH v2] " Davidlohr Bueso
2014-08-05 13:04           ` Geert Uytterhoeven
2014-08-05 17:42             ` Davidlohr Bueso
2014-08-08  1:18               ` Davidlohr Bueso
2014-08-08 10:45                 ` Guenter Roeck
2014-08-15 19:34                 ` Guenter Roeck

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=1403622415.15523.4.camel@buesod1.americas.hpqcorp.net \
    --to=davidlohr@hp.com \
    --cc=aswin@hp.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --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;
as well as URLs for NNTP newsgroup(s).