From: Peter Zijlstra <peterz@infradead.org>
To: Davidlohr Bueso <davidlohr@hp.com>
Cc: Andev <debiandev@gmail.com>, Pranith Kumar <pranith@gatech.edu>,
LKML <linux-kernel@vger.kernel.org>,
jason.low2@hp.com
Subject: Re: [RFC PATCH 1/1] remove redundant compare, cmpxchg already does it
Date: Fri, 6 Jun 2014 09:01:11 +0200 [thread overview]
Message-ID: <20140606070111.GO6758@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <1401991703.13877.36.camel@buesod1.americas.hpqcorp.net>
[-- Attachment #1: Type: text/plain, Size: 812 bytes --]
On Thu, Jun 05, 2014 at 11:08:23AM -0700, Davidlohr Bueso wrote:
> I knew I had formally read this technique somewhere:
> http://pdos.csail.mit.edu/6.828/2010/readings/mcs.pdf (part 2.1).
>
> Peter, what do you think of adding a new cmp_cmpxchg() or dcmpxchg()
> call for such scenarios?
Don't like dcmpxchg(), too easy to confuse with double-cmpxchg or
somesuch.
That said, I'm not entirely sure we want this primitive, the thing is,
people might use it ;-)
And its somewhat dangerous in that it explicitly does not provide any
kind of memory barrier on the fail path, where cmpxchg() is an
unconditional full memory barrier.
Also, you really don't want to use it in loops.
So I think it makes more sense to leave things as are and simply apply
the pattern where safe and meaningful.
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2014-06-06 7:01 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-04 20:38 [RFC PATCH 1/1] remove redundant compare, cmpxchg already does it Pranith Kumar
2014-06-04 20:56 ` Andev
2014-06-05 7:22 ` Peter Zijlstra
2014-06-05 17:54 ` Davidlohr Bueso
2014-06-05 18:08 ` Davidlohr Bueso
2014-06-06 7:01 ` Peter Zijlstra [this message]
2014-06-06 3:09 ` Pranith Kumar
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=20140606070111.GO6758@twins.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=davidlohr@hp.com \
--cc=debiandev@gmail.com \
--cc=jason.low2@hp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pranith@gatech.edu \
/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.