~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/sched/wake_q.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /include/linux/sched/wake_q.h (Architecture ppc) and /include/linux/sched/wake_q.h (Architecture m68k)


  1 /* SPDX-License-Identifier: GPL-2.0 */              1 /* SPDX-License-Identifier: GPL-2.0 */
  2 #ifndef _LINUX_SCHED_WAKE_Q_H                       2 #ifndef _LINUX_SCHED_WAKE_Q_H
  3 #define _LINUX_SCHED_WAKE_Q_H                       3 #define _LINUX_SCHED_WAKE_Q_H
  4                                                     4 
  5 /*                                                  5 /*
  6  * Wake-queues are lists of tasks with a pendi      6  * Wake-queues are lists of tasks with a pending wakeup, whose
  7  * callers have already marked the task as wok      7  * callers have already marked the task as woken internally,
  8  * and can thus carry on. A common use case is      8  * and can thus carry on. A common use case is being able to
  9  * do the wakeups once the corresponding user       9  * do the wakeups once the corresponding user lock as been
 10  * released.                                       10  * released.
 11  *                                                 11  *
 12  * We hold reference to each task in the list      12  * We hold reference to each task in the list across the wakeup,
 13  * thus guaranteeing that the memory is still      13  * thus guaranteeing that the memory is still valid by the time
 14  * the actual wakeups are performed in wake_up     14  * the actual wakeups are performed in wake_up_q().
 15  *                                                 15  *
 16  * One per task suffices, because there's neve     16  * One per task suffices, because there's never a need for a task to be
 17  * in two wake queues simultaneously; it is fo     17  * in two wake queues simultaneously; it is forbidden to abandon a task
 18  * in a wake queue (a call to wake_up_q() _mus     18  * in a wake queue (a call to wake_up_q() _must_ follow), so if a task is
 19  * already in a wake queue, the wakeup will ha     19  * already in a wake queue, the wakeup will happen soon and the second
 20  * waker can just skip it.                         20  * waker can just skip it.
 21  *                                                 21  *
 22  * The DEFINE_WAKE_Q macro declares and initia     22  * The DEFINE_WAKE_Q macro declares and initializes the list head.
 23  * wake_up_q() does NOT reinitialize the list;     23  * wake_up_q() does NOT reinitialize the list; it's expected to be
 24  * called near the end of a function. Otherwis     24  * called near the end of a function. Otherwise, the list can be
 25  * re-initialized for later re-use by wake_q_i     25  * re-initialized for later re-use by wake_q_init().
 26  *                                                 26  *
 27  * NOTE that this can cause spurious wakeups.      27  * NOTE that this can cause spurious wakeups. schedule() callers
 28  * must ensure the call is done inside a loop,     28  * must ensure the call is done inside a loop, confirming that the
 29  * wakeup condition has in fact occurred.          29  * wakeup condition has in fact occurred.
 30  *                                                 30  *
 31  * NOTE that there is no guarantee the wakeup      31  * NOTE that there is no guarantee the wakeup will happen any later than the
 32  * wake_q_add() location. Therefore task must      32  * wake_q_add() location. Therefore task must be ready to be woken at the
 33  * location of the wake_q_add().                   33  * location of the wake_q_add().
 34  */                                                34  */
 35                                                    35 
 36 #include <linux/sched.h>                           36 #include <linux/sched.h>
 37                                                    37 
 38 struct wake_q_head {                               38 struct wake_q_head {
 39         struct wake_q_node *first;                 39         struct wake_q_node *first;
 40         struct wake_q_node **lastp;                40         struct wake_q_node **lastp;
 41 };                                                 41 };
 42                                                    42 
 43 #define WAKE_Q_TAIL ((struct wake_q_node *) 0x     43 #define WAKE_Q_TAIL ((struct wake_q_node *) 0x01)
 44                                                    44 
 45 #define WAKE_Q_HEAD_INITIALIZER(name)              45 #define WAKE_Q_HEAD_INITIALIZER(name)                           \
 46         { WAKE_Q_TAIL, &name.first }               46         { WAKE_Q_TAIL, &name.first }
 47                                                    47 
 48 #define DEFINE_WAKE_Q(name)                        48 #define DEFINE_WAKE_Q(name)                                     \
 49         struct wake_q_head name = WAKE_Q_HEAD_     49         struct wake_q_head name = WAKE_Q_HEAD_INITIALIZER(name)
 50                                                    50 
 51 static inline void wake_q_init(struct wake_q_h     51 static inline void wake_q_init(struct wake_q_head *head)
 52 {                                                  52 {
 53         head->first = WAKE_Q_TAIL;                 53         head->first = WAKE_Q_TAIL;
 54         head->lastp = &head->first;                54         head->lastp = &head->first;
 55 }                                                  55 }
 56                                                    56 
 57 static inline bool wake_q_empty(struct wake_q_     57 static inline bool wake_q_empty(struct wake_q_head *head)
 58 {                                                  58 {
 59         return head->first == WAKE_Q_TAIL;         59         return head->first == WAKE_Q_TAIL;
 60 }                                                  60 }
 61                                                    61 
 62 extern void wake_q_add(struct wake_q_head *hea     62 extern void wake_q_add(struct wake_q_head *head, struct task_struct *task);
 63 extern void wake_q_add_safe(struct wake_q_head     63 extern void wake_q_add_safe(struct wake_q_head *head, struct task_struct *task);
 64 extern void wake_up_q(struct wake_q_head *head     64 extern void wake_up_q(struct wake_q_head *head);
 65                                                    65 
 66 #endif /* _LINUX_SCHED_WAKE_Q_H */                 66 #endif /* _LINUX_SCHED_WAKE_Q_H */
 67                                                    67 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php