1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>struct futex_q</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="Unreliable Guide To Locking"><link rel="up" href="apiref-futex.html" title="Chapter&#160;12.&#160;Futex API reference"><link rel="prev" href="apiref-futex.html" title="Chapter&#160;12.&#160;Futex API reference"><link rel="next" href="API-get-futex-key.html" title="get_futex_key"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"><span class="phrase">struct futex_q</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="apiref-futex.html">Prev</a>&#160;</td><th width="60%" align="center">Chapter&#160;12.&#160;Futex API reference</th><td width="20%" align="right">&#160;<a accesskey="n" href="API-get-futex-key.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-struct-futex-q"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>struct futex_q &#8212; 
2  The hashed futex queue entry, one per waiting task
3 </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="programlisting">
4struct futex_q {
5  struct plist_node list;
6  struct task_struct * task;
7  spinlock_t * lock_ptr;
8  union futex_key key;
9  struct futex_pi_state * pi_state;
10  struct rt_mutex_waiter * rt_waiter;
11  union futex_key * requeue_pi_key;
12  u32 bitset;
13};  </pre></div><div class="refsect1"><a name="idp1124777924"></a><h2>Members</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term">list</span></dt><dd><p>
14priority-sorted list of tasks waiting on this futex
15      </p></dd><dt><span class="term">task</span></dt><dd><p>
16the task waiting on the futex
17      </p></dd><dt><span class="term">lock_ptr</span></dt><dd><p>
18the hash bucket lock
19      </p></dd><dt><span class="term">key</span></dt><dd><p>
20the key the futex is hashed on
21      </p></dd><dt><span class="term">pi_state</span></dt><dd><p>
22optional priority inheritance state
23      </p></dd><dt><span class="term">rt_waiter</span></dt><dd><p>
24rt_waiter storage for use with requeue_pi
25      </p></dd><dt><span class="term">requeue_pi_key</span></dt><dd><p>
26the requeue_pi target futex key
27      </p></dd><dt><span class="term">bitset</span></dt><dd><p>
28bitset for the optional bitmasked wakeup
29      </p></dd></dl></div></div><div class="refsect1"><a name="idp1124783988"></a><h2>Description</h2><p>
30   We use this hashed waitqueue, instead of a normal wait_queue_t, so
31   we can wake only the relevant ones (hashed queues may be shared).
32   </p><p>
33
34   A futex_q has a woken state, just like tasks have TASK_RUNNING.
35   It is considered woken when plist_node_empty(<span class="structname">q</span>-&gt;list) || q-&gt;lock_ptr == 0.
36   The order of wakeup is always to make the first condition true, then
37   the second.
38   </p><p>
39
40   PI futexes are typically woken before they are removed from the hash list via
41   the rt_mutex code. See <code class="function">unqueue_me_pi</code>.
42</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="apiref-futex.html">Prev</a>&#160;</td><td width="20%" align="center"><a accesskey="u" href="apiref-futex.html">Up</a></td><td width="40%" align="right">&#160;<a accesskey="n" href="API-get-futex-key.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter&#160;12.&#160;Futex API reference&#160;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&#160;<span class="phrase">get_futex_key</span></td></tr></table></div></body></html>
43