lkml.org 
[lkml]   [2011]   [May]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] trace: Check for waiting readers before calling wakeup()
On Wed, May 4, 2011 at 2:26 PM, Frederic Weisbecker <fweisbec@gmail.com> wrote:
> On Wed, May 04, 2011 at 02:21:28PM -0700, Vaibhav Nagarnaik wrote:
>> Steven, Frederic
>>
>> Does this patch look ok?
>>
>> Vaibhav Nagarnaik
>>
>
> No problem for me. I'll let Steve give the last word.

Almost every time somebody does this optimization, there's a race.

The thing is, because waitqueue_active() implies no barriers, if there
is somebody adding itself to the waitqueue just at the same time as
somebody is waking things up, the waiter may lose wakeup events -
there is no memory barriers to guarantee that the waker will see
either the waiter, or the waiter will see the event that it waited
for.

I dunno. It's sometimes safe, but it's equally often not safe unless
there is some other locking around the thing. So I'd be a bit nervous.
The tracer people would need to do some serious thinking about it.

Linus


\
 
 \ /
  Last update: 2011-05-05 05:57    [W:0.073 / U:0.568 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site