lkml.org 
[lkml]   [2015]   [Oct]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] ipc/msg: Implement lockless pipelined wakeups
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



\
 
 \ /
  Last update: 2015-10-31 16:41    [W:0.085 / U:0.288 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site