hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/include/linux/sched/wake_q.h
....@@ -24,9 +24,13 @@
2424 * called near the end of a function. Otherwise, the list can be
2525 * re-initialized for later re-use by wake_q_init().
2626 *
27
- * Note that this can cause spurious wakeups. schedule() callers
27
+ * NOTE that this can cause spurious wakeups. schedule() callers
2828 * must ensure the call is done inside a loop, confirming that the
2929 * wakeup condition has in fact occurred.
30
+ *
31
+ * NOTE that there is no guarantee the wakeup will happen any later than the
32
+ * wake_q_add() location. Therefore task must be ready to be woken at the
33
+ * location of the wake_q_add().
3034 */
3135
3236 #include <linux/sched.h>
....@@ -49,29 +53,13 @@
4953 head->count = 0;
5054 }
5155
52
-extern void __wake_q_add(struct wake_q_head *head,
53
- struct task_struct *task, bool sleeper);
54
-static inline void wake_q_add(struct wake_q_head *head,
55
- struct task_struct *task)
56
+static inline bool wake_q_empty(struct wake_q_head *head)
5657 {
57
- __wake_q_add(head, task, false);
58
+ return head->first == WAKE_Q_TAIL;
5859 }
5960
60
-static inline void wake_q_add_sleeper(struct wake_q_head *head,
61
- struct task_struct *task)
62
-{
63
- __wake_q_add(head, task, true);
64
-}
65
-
66
-extern void __wake_up_q(struct wake_q_head *head, bool sleeper);
67
-static inline void wake_up_q(struct wake_q_head *head)
68
-{
69
- __wake_up_q(head, false);
70
-}
71
-
72
-static inline void wake_up_q_sleeper(struct wake_q_head *head)
73
-{
74
- __wake_up_q(head, true);
75
-}
61
+extern void wake_q_add(struct wake_q_head *head, struct task_struct *task);
62
+extern void wake_q_add_safe(struct wake_q_head *head, struct task_struct *task);
63
+extern void wake_up_q(struct wake_q_head *head);
7664
7765 #endif /* _LINUX_SCHED_WAKE_Q_H */