Lines Matching refs:futex

8 #include "futex.h"
13 * Basic futex operation and ordering guarantees
16 * The waiter reads the futex value in user space and calls
18 * the hash bucket lock. After that it reads the futex user space value
23 * The waker side modifies the user space value of the futex and calls
25 * hash bucket lock. Then it looks for waiters on that futex in the hash
28 * In futex wake up scenarios where no tasks are blocked on a futex, taking
35 * val = *futex;
36 * sys_futex(WAIT, futex, val);
37 * futex_wait(futex, val);
38 * uval = *futex;
39 * *futex = newval;
40 * sys_futex(WAKE, futex);
41 * futex_wake(futex);
45 * lock(hash_bucket(futex));
47 * unlock(hash_bucket(futex));
59 * val = *futex;
60 * sys_futex(WAIT, futex, val);
61 * futex_wait(futex, val);
66 * lock(hash_bucket(futex)); |
68 * uval = *futex; |
69 * | *futex = newval;
70 * | sys_futex(WAKE, futex);
71 * | futex_wake(futex);
76 * unlock(hash_bucket(futex));
78 * lock(hash_bucket(futex));
79 * else wake_waiters(futex);
80 * waiters--; (b) unlock(hash_bucket(futex));
82 * Where (A) orders the waiters increment and the futex value read through
84 * to futex and the waiters read (see futex_hb_waiters_pending()).
86 * This yields the following case (where X:=waiters, Y:=futex):
95 * the guarantee that we cannot both miss the futex variable change and the
105 * the code that actually moves the futex(es) between hash buckets (requeue_futex)
112 if (WARN(q->pi_state || q->rt_waiter, "refusing to wake PI futex\n"))
153 * Wake up waiters matching bitset queued on this futex (uaddr).
339 * @hb: the futex hash bucket, must be locked by the caller
383 * - >=0 - Index of the last futex that was awoken;
384 * - -1 - No futex was awoken
400 * @vs: The futex list to wait on
402 * @woken: Index of the last woken futex, if any. Used to notify the
406 * the futex list is invalid or if any futex was already awoken. On success the
423 * each futex on the list before dealing with the next one to avoid
429 * pinning all the memory keys in the futex key, and only then we read
430 * each key and queue the corresponding futex.
461 * next futex. Queue each futex at this moment so hb can
472 * Even if something went wrong, if we find out that a futex
483 * without any lock and any enqueued futex (otherwise
508 * Sleep if and only if the timeout hasn't expired and no futex on the list has
531 * Entry point for the FUTEX_WAIT_MULTIPLE futex operation, this function
532 * sleeps on a group of futexes and returns on the first futex that is
536 * - >=0 - Hint to the futex that was awoken
551 /* A futex was woken during setup */
577 * futex_wait_setup() - Prepare to wait on a futex
578 * @uaddr: the futex userspace address
580 * @flags: futex flags (FLAGS_SHARED, etc.)
584 * Setup the futex_q and locate the hash_bucket. Get the futex value and
605 * The basic logical guarantee of a futex is that it blocks ONLY
708 restart->futex.uaddr = uaddr;
709 restart->futex.val = val;
710 restart->futex.time = *abs_time;
711 restart->futex.bitset = bitset;
712 restart->futex.flags = flags | FLAGS_HAS_TIMEOUT;
722 u32 __user *uaddr = restart->futex.uaddr;
725 if (restart->futex.flags & FLAGS_HAS_TIMEOUT) {
726 t = restart->futex.time;
731 return (long)futex_wait(uaddr, restart->futex.flags,
732 restart->futex.val, tp, restart->futex.bitset);