From: Oleg Nesterov <oleg@redhat.com>
To: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: linux-kernel@vger.kernel.org, mingo@kernel.org,
laijs@cn.fujitsu.com, dipankar@in.ibm.com,
akpm@linux-foundation.org, mathieu.desnoyers@efficios.com,
josh@joshtriplett.org, niv@us.ibm.com, tglx@linutronix.de,
peterz@infradead.org, rostedt@goodmis.org, dhowells@redhat.com,
edumazet@google.com, darren@dvhart.com, fweisbec@gmail.com,
sbw@mit.edu, Linux-Arch <linux-arch@vger.kernel.org>,
Ingo Molnar <mingo@redhat.com>,
Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH v5 tip/core/locking 6/7] locking: Add an smp_mb__after_unlock_lock() for UNLOCK+LOCK barrier
Date: Tue, 10 Dec 2013 18:04:04 +0100 [thread overview]
Message-ID: <20131210170404.GB23506@redhat.com> (raw)
In-Reply-To: <1386638883-25379-6-git-send-email-paulmck@linux.vnet.ibm.com>
On 12/09, Paul E. McKenney wrote:
>
> This commit therefore adds a smp_mb__after_unlock_lock(), which may be
> placed after a LOCK primitive to restore the full-memory-barrier semantic.
> All definitions are currently no-ops, but will be upgraded for some
> architectures when queued locks arrive.
I am wondering, perhaps smp_mb__after_unlock() makes more sense?
Note that it already has the potential user:
--- x/kernel/sched/wait.c
+++ x/kernel/sched/wait.c
@@ -176,8 +176,9 @@ prepare_to_wait(wait_queue_head_t *q, wa
spin_lock_irqsave(&q->lock, flags);
if (list_empty(&wait->task_list))
__add_wait_queue(q, wait);
- set_current_state(state);
+ __set_current_state(state);
spin_unlock_irqrestore(&q->lock, flags);
+ smp_mb__after_unlock();
}
EXPORT_SYMBOL(prepare_to_wait);
@@ -190,8 +191,9 @@ prepare_to_wait_exclusive(wait_queue_hea
spin_lock_irqsave(&q->lock, flags);
if (list_empty(&wait->task_list))
__add_wait_queue_tail(q, wait);
- set_current_state(state);
+ __set_current_state(state);
spin_unlock_irqrestore(&q->lock, flags);
+ smp_mb__after_unlock();
}
EXPORT_SYMBOL(prepare_to_wait_exclusive);
Assuming it can also be used "later", after another LOCK, like in
your example in 5/7.
Oleg.
next prev parent reply other threads:[~2013-12-10 17:03 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20131210012738.GA24317@linux.vnet.ibm.com>
[not found] ` <1386638883-25379-1-git-send-email-paulmck@linux.vnet.ibm.com>
2013-12-10 1:27 ` [PATCH v5 tip/core/locking 3/7] Documentation/memory-barriers.txt: Prohibit speculative writes Paul E. McKenney
2013-12-10 1:28 ` [PATCH v5 tip/core/locking 6/7] locking: Add an smp_mb__after_unlock_lock() for UNLOCK+LOCK barrier Paul E. McKenney
2013-12-10 1:28 ` Paul E. McKenney
2013-12-10 1:34 ` Josh Triplett
2013-12-10 5:26 ` Paul E. McKenney
2013-12-10 18:53 ` Paul E. McKenney
2013-12-10 12:37 ` Peter Zijlstra
2013-12-10 17:17 ` Paul E. McKenney
2013-12-10 17:45 ` Josh Triplett
2013-12-10 20:11 ` Paul E. McKenney
2013-12-10 17:04 ` Oleg Nesterov [this message]
2013-12-10 17:18 ` Paul E. McKenney
2013-12-10 17:18 ` Paul E. McKenney
2013-12-10 17:32 ` Oleg Nesterov
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=20131210170404.GB23506@redhat.com \
--to=oleg@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=darren@dvhart.com \
--cc=dhowells@redhat.com \
--cc=dipankar@in.ibm.com \
--cc=edumazet@google.com \
--cc=fweisbec@gmail.com \
--cc=josh@joshtriplett.org \
--cc=laijs@cn.fujitsu.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mingo@kernel.org \
--cc=mingo@redhat.com \
--cc=niv@us.ibm.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=sbw@mit.edu \
--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