From: Davidlohr Bueso <dave@stgolabs.net>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: linux-kernel@vger.kernel.org,
Peter Zijlstra <peterz@infradead.org>,
tglx@linutronix.de, Manfred Spraul <manfred@colorfullife.com>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH v3] ipc/msg: Implement lockless pipelined wakeups
Date: Tue, 7 Jun 2016 07:59:45 -0700 [thread overview]
Message-ID: <20160607145945.qf5bienv3wnj7jrt@linux-uzut.site> (raw)
In-Reply-To: <1465233650-12085-1-git-send-email-bigeasy@linutronix.de>
On Mon, 06 Jun 2016, Sebastian Andrzej Siewior wrote:
>-static void expunge_all(struct msg_queue *msq, int res)
>+static void expunge_all(struct msg_queue *msq, int res,
>+ struct wake_q_head *wake_q)
> {
> struct msg_receiver *msr, *t;
>
> list_for_each_entry_safe(msr, t, &msq->q_receivers, r_list) {
>- msr->r_msg = NULL; /* initialize expunge ordering */
>- wake_up_process(msr->r_tsk);
>- /*
>- * Ensure that the wakeup is visible before setting r_msg as
>- * the receiving end depends on it: either spinning on a nil,
>- * or dealing with -EAGAIN cases. See lockless receive part 1
>- * and 2 in do_msgrcv().
>- */
>+
>+ WRITE_ONCE(msr->r_msg, ERR_PTR(res));
> smp_wmb(); /* barrier (B) */
>- msr->r_msg = ERR_PTR(res);
>+ wake_q_add(wake_q, msr->r_tsk);
Given that wake_q_add() implies barriers on both sides (cmpxchg), I think we
can rely on that instead of the explicit smp_wmb() for barrier B. While a failed
call doesn't imply the barriers, we're already in a world of trouble _anyways_
if that's the case. Same for pipelined_send, obviously.
Thanks,
Davidlohr
prev parent reply other threads:[~2016-06-07 14:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-06 17:20 Sebastian Andrzej Siewior
2016-06-07 14:59 ` Davidlohr Bueso [this message]
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=20160607145945.qf5bienv3wnj7jrt@linux-uzut.site \
--to=dave@stgolabs.net \
--cc=akpm@linux-foundation.org \
--cc=bigeasy@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=manfred@colorfullife.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/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
all inboxes | Powered by JetHome®