.. | .. |
---|
9 | 9 | #include <asm/current.h> |
---|
10 | 10 | |
---|
11 | 11 | /* |
---|
12 | | - * BROKEN wait-queues. |
---|
13 | | - * |
---|
14 | | - * These "simple" wait-queues are broken garbage, and should never be |
---|
15 | | - * used. The comments below claim that they are "similar" to regular |
---|
16 | | - * wait-queues, but the semantics are actually completely different, and |
---|
17 | | - * every single user we have ever had has been buggy (or pointless). |
---|
18 | | - * |
---|
19 | | - * A "swake_up_one()" only wakes up _one_ waiter, which is not at all what |
---|
20 | | - * "wake_up()" does, and has led to problems. In other cases, it has |
---|
21 | | - * been fine, because there's only ever one waiter (kvm), but in that |
---|
22 | | - * case gthe whole "simple" wait-queue is just pointless to begin with, |
---|
23 | | - * since there is no "queue". Use "wake_up_process()" with a direct |
---|
24 | | - * pointer instead. |
---|
25 | | - * |
---|
26 | | - * While these are very similar to regular wait queues (wait.h) the most |
---|
27 | | - * important difference is that the simple waitqueue allows for deterministic |
---|
28 | | - * behaviour -- IOW it has strictly bounded IRQ and lock hold times. |
---|
| 12 | + * Simple waitqueues are semantically very different to regular wait queues |
---|
| 13 | + * (wait.h). The most important difference is that the simple waitqueue allows |
---|
| 14 | + * for deterministic behaviour -- IOW it has strictly bounded IRQ and lock hold |
---|
| 15 | + * times. |
---|
29 | 16 | * |
---|
30 | 17 | * Mainly, this is accomplished by two things. Firstly not allowing swake_up_all |
---|
31 | 18 | * from IRQ disabled, and dropping the lock upon every wakeup, giving a higher |
---|
.. | .. |
---|
39 | 26 | * sleeper state. |
---|
40 | 27 | * |
---|
41 | 28 | * - the !exclusive mode; because that leads to O(n) wakeups, everything is |
---|
42 | | - * exclusive. |
---|
| 29 | + * exclusive. As such swake_up_one will only ever awake _one_ waiter. |
---|
43 | 30 | * |
---|
44 | 31 | * - custom wake callback functions; because you cannot give any guarantees |
---|
45 | 32 | * about random code. This also allows swait to be used in RT, such that |
---|
.. | .. |
---|
160 | 147 | extern void swake_up_one(struct swait_queue_head *q); |
---|
161 | 148 | extern void swake_up_all(struct swait_queue_head *q); |
---|
162 | 149 | extern void swake_up_locked(struct swait_queue_head *q); |
---|
163 | | -extern void swake_up_all_locked(struct swait_queue_head *q); |
---|
164 | 150 | |
---|
165 | | -extern void __prepare_to_swait(struct swait_queue_head *q, struct swait_queue *wait); |
---|
166 | 151 | extern void prepare_to_swait_exclusive(struct swait_queue_head *q, struct swait_queue *wait, int state); |
---|
167 | 152 | extern long prepare_to_swait_event(struct swait_queue_head *q, struct swait_queue *wait, int state); |
---|
168 | 153 | |
---|
.. | .. |
---|
298 | 283 | condition, timeout); \ |
---|
299 | 284 | __ret; \ |
---|
300 | 285 | }) |
---|
301 | | - |
---|
302 | | -#define __swait_event_lock_irq(wq, condition, lock, cmd) \ |
---|
303 | | - ___swait_event(wq, condition, TASK_UNINTERRUPTIBLE, 0, \ |
---|
304 | | - raw_spin_unlock_irq(&lock); \ |
---|
305 | | - cmd; \ |
---|
306 | | - schedule(); \ |
---|
307 | | - raw_spin_lock_irq(&lock)) |
---|
308 | | - |
---|
309 | | -#define swait_event_lock_irq(wq_head, condition, lock) \ |
---|
310 | | - do { \ |
---|
311 | | - if (condition) \ |
---|
312 | | - break; \ |
---|
313 | | - __swait_event_lock_irq(wq_head, condition, lock, ); \ |
---|
314 | | - } while (0) |
---|
315 | 286 | |
---|
316 | 287 | #endif /* _LINUX_SWAIT_H */ |
---|