include/linux/local_lock_internal.h
Source file repositories/reference/linux-study-clean/include/linux/local_lock_internal.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/local_lock_internal.h- Extension
.h- Size
- 8978 bytes
- Lines
- 340
- 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.
- 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
linux/percpu-defs.hlinux/irqflags.hlinux/lockdep.hlinux/debug_locks.hasm/current.hlinux/sched.hlinux/spinlock.h
Detected Declarations
function local_lock_acquirefunction local_trylock_acquirefunction local_lock_releasefunction local_lock_debug_initfunction local_lock_acquire
Annotated Snippet
static inline void local_lock_acquire(local_lock_t *l) { }
static inline void local_trylock_acquire(local_lock_t *l) { }
static inline void local_lock_release(local_lock_t *l) { }
static inline void local_lock_debug_init(local_lock_t *l) { }
#endif /* !CONFIG_DEBUG_LOCK_ALLOC */
#define INIT_LOCAL_LOCK(lockname) { LOCAL_LOCK_DEBUG_INIT(lockname) }
#define INIT_LOCAL_TRYLOCK(lockname) { LOCAL_TRYLOCK_DEBUG_INIT(lockname) }
#define __local_lock_init(lock) \
do { \
static struct lock_class_key __key; \
\
debug_check_no_locks_freed((void *)lock, sizeof(*lock));\
lockdep_init_map_type(&(lock)->dep_map, #lock, &__key, \
0, LD_WAIT_CONFIG, LD_WAIT_INV, \
LD_LOCK_PERCPU); \
local_lock_debug_init(lock); \
} while (0)
#define __local_trylock_init(lock) \
do { \
__local_lock_init((local_lock_t *)lock); \
} while (0)
#define __spinlock_nested_bh_init(lock) \
do { \
static struct lock_class_key __key; \
\
debug_check_no_locks_freed((void *)lock, sizeof(*lock));\
lockdep_init_map_type(&(lock)->dep_map, #lock, &__key, \
0, LD_WAIT_CONFIG, LD_WAIT_INV, \
LD_LOCK_NORMAL); \
local_lock_debug_init(lock); \
} while (0)
#define __local_lock_acquire(lock) \
do { \
local_trylock_t *__tl; \
local_lock_t *__l; \
\
__l = (local_lock_t *)(lock); \
__tl = (local_trylock_t *)__l; \
_Generic((lock), \
local_trylock_t *: ({ \
lockdep_assert(__tl->acquired == 0); \
WRITE_ONCE(__tl->acquired, 1); \
}), \
local_lock_t *: (void)0); \
local_lock_acquire(__l); \
} while (0)
#define __local_lock(lock) \
do { \
preempt_disable(); \
__local_lock_acquire(lock); \
__acquire(lock); \
} while (0)
#define __local_lock_irq(lock) \
do { \
local_irq_disable(); \
__local_lock_acquire(lock); \
__acquire(lock); \
} while (0)
#define __local_lock_irqsave(lock, flags) \
do { \
local_irq_save(flags); \
__local_lock_acquire(lock); \
__acquire(lock); \
} while (0)
#define __local_trylock(lock) \
__try_acquire_ctx_lock(lock, ({ \
local_trylock_t *__tl; \
\
preempt_disable(); \
__tl = (lock); \
if (READ_ONCE(__tl->acquired)) { \
preempt_enable(); \
__tl = NULL; \
} else { \
WRITE_ONCE(__tl->acquired, 1); \
local_trylock_acquire( \
(local_lock_t *)__tl); \
} \
!!__tl; \
}))
Annotation
- Immediate include surface: `linux/percpu-defs.h`, `linux/irqflags.h`, `linux/lockdep.h`, `linux/debug_locks.h`, `asm/current.h`, `linux/sched.h`, `linux/spinlock.h`.
- Detected declarations: `function local_lock_acquire`, `function local_trylock_acquire`, `function local_lock_release`, `function local_lock_debug_init`, `function local_lock_acquire`.
- Atlas domain: Core OS / Core Kernel Interface.
- 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.