Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1416282
| From | Davidlohr Bueso <dave@stgolabs.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v3] ipc/msg: Implement lockless pipelined wakeups |
| Date | 2016-06-07 17:10 +0200 |
| Message-ID | <rHqNH-4i3-3@gated-at.bofh.it> (permalink) |
| References | <rH6vE-7U4-13@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH v3] ipc/msg: Implement lockless pipelined wakeups Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-06-06 19:30 +0200 Re: [PATCH v3] ipc/msg: Implement lockless pipelined wakeups Davidlohr Bueso <dave@stgolabs.net> - 2016-06-07 17:10 +0200
csiph-web