From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753180AbbJaPSQ (ORCPT ); Sat, 31 Oct 2015 11:18:16 -0400 Received: from www.linutronix.de ([62.245.132.108]:35158 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750715AbbJaPSO (ORCPT ); Sat, 31 Oct 2015 11:18:14 -0400 Date: Sat, 31 Oct 2015 16:17:31 +0100 (CET) From: Thomas Gleixner To: George Spelvin cc: bigeasy@linutronix.de, akpm@linux-foundation.org, dave@stgolabs.net, linux-kernel@vger.kernel.org, manfred@colorfullife.com, peterz@infradead.org Subject: Re: [PATCH] ipc/msg: Implement lockless pipelined wakeups In-Reply-To: <20151031130214.10598.qmail@ns.horizon.com> Message-ID: References: <20151031130214.10598.qmail@ns.horizon.com> User-Agent: Alpine 2.11 (DEB 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > > 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. Right. I figured that after staring some more into it. Though it would be nice if exactly that explanation is in the code. Thanks, tglx