include/linux/sched/wake_q.h
Source file repositories/reference/linux-study-clean/include/linux/sched/wake_q.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/sched/wake_q.h- Extension
.h- Size
- 3069 bytes
- Lines
- 104
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/sched.h
Detected Declarations
struct wake_q_headfunction wake_q_initfunction wake_q_emptyfunction raw_spin_unlock_wakefunction raw_spin_unlock_irq_wakefunction raw_spin_unlock_irqrestore_wake
Annotated Snippet
struct wake_q_head {
struct wake_q_node *first;
struct wake_q_node **lastp;
};
#define WAKE_Q_TAIL ((struct wake_q_node *) 0x01)
#define WAKE_Q_HEAD_INITIALIZER(name) \
{ WAKE_Q_TAIL, &name.first }
#define DEFINE_WAKE_Q(name) \
struct wake_q_head name = WAKE_Q_HEAD_INITIALIZER(name)
static inline void wake_q_init(struct wake_q_head *head)
{
head->first = WAKE_Q_TAIL;
head->lastp = &head->first;
}
static inline bool wake_q_empty(struct wake_q_head *head)
{
return head->first == WAKE_Q_TAIL;
}
extern void wake_q_add(struct wake_q_head *head, struct task_struct *task);
extern void wake_q_add_safe(struct wake_q_head *head, struct task_struct *task);
extern void wake_up_q(struct wake_q_head *head);
/* Spin unlock helpers to unlock and call wake_up_q with preempt disabled */
static inline
void raw_spin_unlock_wake(raw_spinlock_t *lock, struct wake_q_head *wake_q)
__releases(lock)
{
guard(preempt)();
raw_spin_unlock(lock);
if (wake_q) {
wake_up_q(wake_q);
wake_q_init(wake_q);
}
}
static inline
void raw_spin_unlock_irq_wake(raw_spinlock_t *lock, struct wake_q_head *wake_q)
__releases(lock)
{
guard(preempt)();
raw_spin_unlock_irq(lock);
if (wake_q) {
wake_up_q(wake_q);
wake_q_init(wake_q);
}
}
static inline
void raw_spin_unlock_irqrestore_wake(raw_spinlock_t *lock, unsigned long flags,
struct wake_q_head *wake_q)
__releases(lock)
{
guard(preempt)();
raw_spin_unlock_irqrestore(lock, flags);
if (wake_q) {
wake_up_q(wake_q);
wake_q_init(wake_q);
}
}
#endif /* _LINUX_SCHED_WAKE_Q_H */
Annotation
- Immediate include surface: `linux/sched.h`.
- Detected declarations: `struct wake_q_head`, `function wake_q_init`, `function wake_q_empty`, `function raw_spin_unlock_wake`, `function raw_spin_unlock_irq_wake`, `function raw_spin_unlock_irqrestore_wake`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.