From: Alexander Fyodorov <halcy@yandex.ru>
To: Waiman Long <waiman.long@hp.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
"Chandramouleeswaran, Aswin" <aswin@hp.com>,
"Norton, Scott J" <scott.norton@hp.com>,
Peter Zijlstra <peterz@infradead.org>,
Steven Rostedt <rostedt@goodmis.org>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>
Subject: Re: [PATCH RFC v2 1/2] qspinlock: Introducing a 4-byte queue spinlock implementation
Date: Tue, 27 Aug 2013 16:09:15 +0400 [thread overview]
Message-ID: <66111377605355@web12m.yandex.ru> (raw)
In-Reply-To: <521BB71F.6080300@hp.com>
> I also thought that the x86 spinlock unlock path was an atomic add. It
> just comes to my realization recently that this is not the case. The
> UNLOCK_LOCK_PREFIX will be mapped to "" except for some old 32-bit x86
> processors.
Hmm, I didn't know that. Looking through Google found these rules for x86 memory ordering:
* Loads are not reordered with other loads.
* Stores are not reordered with other stores.
* Stores are not reordered with older loads.
So x86 memory model is rather strict and memory barrier is really not needed in the unlock path - xadd is a store and thus behaves like a memory barrier, and since only lock's owner modifies "ticket.head" the "add" instruction need not be atomic.
But this is true only for x86, other architectures have more relaxed memory ordering. Maybe we should allow arch code to redefine queue_spin_unlock()? And define a version without smp_mb() for x86?
next prev parent reply other threads:[~2013-08-27 12:15 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <15321377012704@web8h.yandex.ru>
2013-08-21 3:01 ` [PATCH RFC v2 1/2] qspinlock: Introducing a 4-byte queue spinlock implementation Waiman Long
2013-08-21 15:51 ` Alexander Fyodorov
2013-08-22 1:04 ` Waiman Long
2013-08-22 13:28 ` Alexander Fyodorov
2013-08-26 20:14 ` Waiman Long
2013-08-27 12:09 ` Alexander Fyodorov [this message]
[not found] ` <20130827091436.3d5971a0@gandalf.local.home>
2013-08-27 13:53 ` Peter Zijlstra
2013-08-28 1:21 ` Paul E. McKenney
2013-08-28 8:19 ` Peter Zijlstra
2013-08-28 12:59 ` Steven Rostedt
2013-08-28 13:05 ` Peter Zijlstra
2013-08-28 13:15 ` Steven Rostedt
2013-08-28 13:37 ` Peter Zijlstra
2013-08-29 15:24 ` Waiman Long
2013-08-29 17:03 ` Alexander Fyodorov
2013-08-30 3:16 ` Waiman Long
2013-08-30 8:15 ` Alexander Fyodorov
2013-08-13 18:41 [PATCH RFC v2 0/2] qspinlock: Introducing a 4-byte queue spinlock Waiman Long
2013-08-13 18:41 ` [PATCH RFC v2 1/2] qspinlock: Introducing a 4-byte queue spinlock implementation Waiman Long
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=66111377605355@web12m.yandex.ru \
--to=halcy@yandex.ru \
--cc=aswin@hp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=scott.norton@hp.com \
--cc=tglx@linutronix.de \
--cc=waiman.long@hp.com \
/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