---
name: "struct_futex_q"
section: "9"
platform: "linux"
package: "linux-manual-4.9"
version: "4.9.228-1"
release: "Debian 9 (Stretch)"
platforms: ["linux"]
url: "https://new.carta.tech/struct_futex_q"
---

# struct\_futex\_q(9)

The hashed futex queue entry, one per waiting task

## NAME

struct\_futex\_q - The hashed futex queue entry, one per waiting task

## SYNOPSIS

```
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;
};
```

## MEMBERS

list

priority-sorted list of tasks waiting on this futex

task

the task waiting on the futex

lock\_ptr

the hash bucket lock

key

the key the futex is hashed on

pi\_state

optional priority inheritance state

rt\_waiter

rt\_waiter storage for use with requeue\_pi

requeue\_pi\_key

the requeue\_pi target futex key

bitset

bitset for the optional bitmasked wakeup

## DESCRIPTION

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-\>list) \|\| q-\>lock\_ptr == 0. The order of wakeup is always to make the first condition true, then the second.

PI futexes are typically woken before they are removed from the hash list via the rt\_mutex code. See **unqueue\_me\_pi**.

## AUTHOR

**Rusty Russell** \<rusty@rustcorp.com.au\>

Author.

## COPYRIGHT
