public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Davidlohr Bueso <dave@stgolabs.net>
To: George Spelvin <linux@horizon.com>
Cc: bigeasy@linutronix.de, tglx@linutronix.de,
	akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
	manfred@colorfullife.com, peterz@infradead.org
Subject: Re: [PATCH] ipc/msg: Implement lockless pipelined wakeups
Date: Sat, 31 Oct 2015 11:54:57 -0700	[thread overview]
Message-ID: <20151031185457.GC7947@linux-uzut.site> (raw)
In-Reply-To: <20151031130214.10598.qmail@ns.horizon.com>

On Sat, 31 Oct 2015, George Spelvin wrote:

>> Don't we need to keep that NULL init? I might be missing something.
>
>I wondered the same thing, but on reading it, the cleanup is that he's
>gotten rid of the need for the entire thing.  Previously, there was a
>mechanism for detecting "wakeup not quite finished" that used a NULL
>value, but it's no longer needed.
>
>The resultant busy-waiting on the part of the woken-up task was the
>entire problem this patch aims to fix.  So it gets rid of a whole lot
>of code and barriers.  And, as you noticed, the comments explaining them.
>
>As the old code explained, the issue is that a task may exit as
>soon as r_msg is set, so the wakeup procedure has to be:
>- Ensure r_msg is set to NULL (special-case flag)
>- Do the wake up
>- Set r_msg to the final value
>
>The woken-up task has to spin as long as r_msg is NULL.  Ick.

I agree this is a nice cleanup. It is similar to what we did
with posix mqueues, but this one gets rid of even more code afaict.

>However, a wake_q keeps a reference to a task, so exiting is
>not a danger.  As long as wake_q_add precedes setting r_msg,
>all is well.

Yes, and this confirms that we still rely on the implicit barrier
from the cmpxchg as tglx mentioned. As such, we also need to keep
the pairing when reading 'r_msg' in do_msgrcv(), instead of dropping
the comments.

Thanks,
Davidlohr

  parent reply	other threads:[~2015-10-31 18:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-30 11:26 [PATCH] ipc/msg: Implement lockless pipelined wakeups Sebastian Andrzej Siewior
2015-10-30 22:30 ` George Spelvin
2015-11-03 14:01   ` Sebastian Andrzej Siewior
2015-10-31 10:31 ` Thomas Gleixner
2015-10-31 13:02   ` George Spelvin
2015-10-31 15:17     ` Thomas Gleixner
2015-10-31 18:54     ` Davidlohr Bueso [this message]
2015-10-31 19:06       ` Davidlohr Bueso
2015-11-03 14:15         ` Sebastian Andrzej Siewior
2015-11-03 14:11       ` Sebastian Andrzej Siewior
2015-11-01  4:32 ` Manfred Spraul
2015-11-03 14:51   ` Sebastian Andrzej Siewior

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=20151031185457.GC7947@linux-uzut.site \
    --to=dave@stgolabs.net \
    --cc=akpm@linux-foundation.org \
    --cc=bigeasy@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@horizon.com \
    --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