include/linux/jump_label.h
Source file repositories/reference/linux-study-clean/include/linux/jump_label.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/jump_label.h- Extension
.h- Size
- 16207 bytes
- Lines
- 530
- 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/types.hlinux/compiler.hlinux/cleanup.hasm/jump_label.hlinux/atomic.hlinux/bug.h
Detected Declarations
struct static_keystruct jump_entrystruct modulestruct static_key_truestruct static_key_falseenum jump_label_typefunction jump_entry_codefunction jump_entry_targetfunction jump_entry_codefunction jump_entry_targetfunction jump_entry_is_branchfunction jump_entry_is_initfunction jump_entry_set_initfunction jump_entry_sizefunction static_key_falsefunction static_key_truefunction static_key_countfunction jump_label_initfunction jump_label_init_rofunction static_key_truefunction static_key_fast_inc_not_disabledfunction static_key_slow_decfunction jump_label_text_reservedfunction jump_label_lockfunction static_key_disable
Annotated Snippet
struct static_key {
atomic_t enabled;
#ifdef CONFIG_JUMP_LABEL
/*
* bit 0 => 1 if key is initially true
* 0 if initially false
* bit 1 => 1 if points to struct static_key_mod
* 0 if points to struct jump_entry
*/
union {
unsigned long type;
struct jump_entry *entries;
struct static_key_mod *next;
};
#endif /* CONFIG_JUMP_LABEL */
};
#endif /* __ASSEMBLY__ */
#ifdef CONFIG_JUMP_LABEL
#include <asm/jump_label.h>
#ifndef __ASSEMBLY__
#ifdef CONFIG_HAVE_ARCH_JUMP_LABEL_RELATIVE
struct jump_entry {
s32 code;
s32 target;
long key; // key may be far away from the core kernel under KASLR
};
static inline unsigned long jump_entry_code(const struct jump_entry *entry)
{
return (unsigned long)&entry->code + entry->code;
}
static inline unsigned long jump_entry_target(const struct jump_entry *entry)
{
return (unsigned long)&entry->target + entry->target;
}
static inline struct static_key *jump_entry_key(const struct jump_entry *entry)
{
long offset = entry->key & ~3L;
return (struct static_key *)((unsigned long)&entry->key + offset);
}
#else
static inline unsigned long jump_entry_code(const struct jump_entry *entry)
{
return entry->code;
}
static inline unsigned long jump_entry_target(const struct jump_entry *entry)
{
return entry->target;
}
static inline struct static_key *jump_entry_key(const struct jump_entry *entry)
{
return (struct static_key *)((unsigned long)entry->key & ~3UL);
}
#endif
static inline bool jump_entry_is_branch(const struct jump_entry *entry)
{
return (unsigned long)entry->key & 1UL;
}
static inline bool jump_entry_is_init(const struct jump_entry *entry)
{
return (unsigned long)entry->key & 2UL;
}
static inline void jump_entry_set_init(struct jump_entry *entry, bool set)
{
if (set)
entry->key |= 2;
else
entry->key &= ~2;
}
static inline int jump_entry_size(struct jump_entry *entry)
{
#ifdef JUMP_LABEL_NOP_SIZE
return JUMP_LABEL_NOP_SIZE;
#else
Annotation
- Immediate include surface: `linux/types.h`, `linux/compiler.h`, `linux/cleanup.h`, `asm/jump_label.h`, `linux/atomic.h`, `linux/bug.h`.
- Detected declarations: `struct static_key`, `struct jump_entry`, `struct module`, `struct static_key_true`, `struct static_key_false`, `enum jump_label_type`, `function jump_entry_code`, `function jump_entry_target`, `function jump_entry_code`, `function jump_entry_target`.
- 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.