lkml.org 
[lkml]   [2011]   [Sep]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC][PATCH 2/3] futex: Reduce hash bucket lock contention
On 09/16/2011 02:34 PM, Peter Zijlstra wrote:
> So while initially I thought the sem patch was busted, it turns out this
> one is.
>
> Thomas managed to spot the race:
>
> Task-0 Task-1
>
> futex_wait()
> queue_me()
>
> futex_wake()
> wake_list_add();
> __unqueue_futex();
> plist_del();
> if (!plist_node_empty())
> __set_current_state(TASK_RUNNNIG);
>
> wake_up_list();
> /* waking an already running task-0 */
>
>
> I guess the biggest question is, do we care? Ideally everything should
> be able to deal with spurious wakeups, although we generally try to
> avoid them.
>
>
The sem patch also causes such wakeups:

Task-0 Task-1
semtimedop()
schedule_timeout()

semtimedop()
wake_list_add();
q->status = 0;
<Timeout>
schedule_timeout() returns
if (q->status==0)
return;
semtimedop() returns
random user space/kernel space code

spin_unlock();
wake_up_list();

It's a rare event, but that does happen.
Which means:
How do we verify that everything is able to deal with spurious wakeups?

--
Manfred


\
 
 \ /
  Last update: 2011-09-17 14:53    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site