kernel/bpf/rqspinlock.h
Source file repositories/reference/linux-study-clean/kernel/bpf/rqspinlock.h
File Facts
- System
- Linux kernel
- Corpus path
kernel/bpf/rqspinlock.h- Extension
.h- Size
- 1444 bytes
- Lines
- 49
- Domain
- Core OS
- Bucket
- Scheduler, Processes, Timers, Sync, And Syscalls
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
../locking/qspinlock.h
Detected Declarations
function try_cmpxchg_tail
Annotated Snippet
#ifndef __LINUX_RQSPINLOCK_H
#define __LINUX_RQSPINLOCK_H
#include "../locking/qspinlock.h"
/*
* try_cmpxchg_tail - Return result of cmpxchg of tail word with a new value
* @lock: Pointer to queued spinlock structure
* @tail: The tail to compare against
* @new_tail: The new queue tail code word
* Return: Bool to indicate whether the cmpxchg operation succeeded
*
* This is used by the head of the wait queue to clean up the queue.
* Provides relaxed ordering, since observers only rely on initialized
* state of the node which was made visible through the xchg_tail operation,
* i.e. through the smp_wmb preceding xchg_tail.
*
* We avoid using 16-bit cmpxchg, which is not available on all architectures.
*/
static __always_inline bool try_cmpxchg_tail(struct qspinlock *lock, u32 tail, u32 new_tail)
{
u32 old, new;
old = atomic_read(&lock->val);
do {
/*
* Is the tail part we compare to already stale? Fail.
*/
if ((old & _Q_TAIL_MASK) != tail)
return false;
/*
* Encode latest locked/pending state for new tail.
*/
new = (old & _Q_LOCKED_PENDING_MASK) | new_tail;
} while (!atomic_try_cmpxchg_relaxed(&lock->val, &old, new));
return true;
}
#endif /* __LINUX_RQSPINLOCK_H */
Annotation
- Immediate include surface: `../locking/qspinlock.h`.
- Detected declarations: `function try_cmpxchg_tail`.
- Atlas domain: Core OS / Scheduler, Processes, Timers, Sync, And Syscalls.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.