struct futex_q — The hashed futex queue entry, one per waiting task
struct futex_q {
struct plist_node list;
struct task_struct * task;
spinlock_t * lock_ptr;
union futex_key key;
struct futex_pi_state * pi_state;
struct rt_mutex_waiter * rt_waiter;
union futex_key * requeue_pi_key;
u32 bitset;
}; struct plist_node listpriority-sorted list of tasks waiting on this futex
struct task_struct * taskthe task waiting on the futex
spinlock_t * lock_ptrthe hash bucket lock
union futex_key keythe key the futex is hashed on
struct futex_pi_state * pi_stateoptional priority inheritance state
struct rt_mutex_waiter * rt_waiterrt_waiter storage for use with requeue_pi
union futex_key * requeue_pi_keythe requeue_pi target futex key
u32 bitsetbitset for the optional bitmasked wakeup
We use this hashed waitqueue, instead of a normal wait_queue_t, so we can wake only the relevant ones (hashed queues may be shared).
A futex_q has a woken state, just like tasks have TASK_RUNNING.
It is considered woken when plist_node_empty(q->) || q->lock_ptr == 0.
The order of wakeup is always to make the first condition true, then
the second.
list
PI futexes are typically woken before they are removed from the hash list via
the rt_mutex code. See unqueue_me_pi.