Lines Matching refs:the
5 special handling in order to ensure the underlying rt_mutex is never
6 left without an owner if it has waiters; doing so would break the PI
7 boosting logic [see rt-mutex-desgin.txt] For the purposes of
15 Without requeue_pi, the glibc implementation of
16 pthread_cond_broadcast() must resort to waking all the tasks waiting
19 implementation would wake the highest-priority waiter, and leave the
20 rest to the natural wakeup inherent in unlocking the mutex
21 associated with the condvar.
23 Consider the simplified glibc calls:
46 Once pthread_cond_broadcast() requeues the tasks, the cond->mutex
47 has waiters. Note that pthread_cond_wait() attempts to lock the
48 mutex only after it has returned to user space. This will leave the
49 underlying rt_mutex with waiters, and no owner, breaking the
52 In order to support PI-aware pthread_condvar's, the kernel needs to
54 upon a successful futex_wait system call, the caller would return to
55 user space already holding the PI futex. The glibc implementation
70 /* the kernel acquired the mutex for us */
80 The actual glibc implementation will likely test for PI and make the
81 necessary changes inside the existing calls rather than creating new
82 calls for the PI cases. Similar changes are needed for
88 In order to ensure the rt_mutex has an owner if it has waiters, it
89 is necessary for both the requeue code, as well as the waiting code,
90 to be able to acquire the rt_mutex before returning to user space.
91 The requeue code cannot simply wake the waiter and leave it to
92 acquire the rt_mutex as it would open a race window between the
93 requeue call returning to user space and the waiter waking and
94 starting to run. This is especially true in the uncontended case.
98 allow the requeue code to acquire an uncontended rt_mutex on behalf
99 of the waiter and to enqueue the waiter on a contended rt_mutex.
100 Two new system calls provide the kernel<->user interface to
103 FUTEX_WAIT_REQUEUE_PI is called by the waiter (pthread_cond_wait()
104 and pthread_cond_timedwait()) to block on the initial futex and wait
105 to be requeued to a PI-aware futex. The implementation is the
107 futex_lock_pi(), with some extra logic to check for the additional
110 FUTEX_CMP_REQUEUE_PI is called by the waker
112 possibly wake the waiting tasks. Internally, this system call is
114 requeueing, futex_requeue() attempts to acquire the requeue target
115 PI futex on behalf of the top waiter. If it can, this waiter is
116 woken. futex_requeue() then proceeds to requeue the remaining
117 nr_wake+nr_requeue tasks to the PI futex, calling
118 rt_mutex_start_proxy_lock() prior to each requeue to prepare the
119 task as a waiter on the underlying rt_mutex. It is possible that
120 the lock can be acquired at this stage as well, if so, the next
121 waiter is woken to finish the acquisition of the lock.
126 tasks as it can acquire the lock for, which in the majority of cases
127 should be 0 as good programming practice dictates that the caller of
128 either pthread_cond_broadcast() or pthread_cond_signal() acquire the
129 mutex prior to making the call. FUTEX_CMP_REQUEUE_PI requires that