kernel/trace/tracing_map.h
Source file repositories/reference/linux-study-clean/kernel/trace/tracing_map.h
File Facts
- System
- Linux kernel
- Corpus path
kernel/trace/tracing_map.h- Extension
.h- Size
- 11454 bytes
- Lines
- 285
- 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
- No C-style include directives detected by the generator.
Detected Declarations
struct tracing_map_fieldstruct tracing_map_eltstruct tracing_map_entrystruct tracing_map_sort_keystruct tracing_map_sort_entrystruct tracing_map_arraystruct tracing_mapstruct tracing_map_ops
Annotated Snippet
struct tracing_map_field {
tracing_map_cmp_fn_t cmp_fn;
union {
atomic64_t sum;
unsigned int offset;
};
};
struct tracing_map_elt {
struct tracing_map *map;
struct tracing_map_field *fields;
atomic64_t *vars;
bool *var_set;
void *key;
void *private_data;
};
struct tracing_map_entry {
u32 key;
struct tracing_map_elt *val;
};
struct tracing_map_sort_key {
unsigned int field_idx;
bool descending;
};
struct tracing_map_sort_entry {
void *key;
struct tracing_map_elt *elt;
bool elt_copied;
bool dup;
};
struct tracing_map_array {
unsigned int entries_per_page;
unsigned int entry_size_shift;
unsigned int entry_shift;
unsigned int entry_mask;
unsigned int n_pages;
void *pages[] __counted_by(n_pages);
};
#define TRACING_MAP_ARRAY_ELT(array, idx) \
(array->pages[idx >> array->entry_shift] + \
((idx & array->entry_mask) << array->entry_size_shift))
#define TRACING_MAP_ENTRY(array, idx) \
((struct tracing_map_entry *)TRACING_MAP_ARRAY_ELT(array, idx))
#define TRACING_MAP_ELT(array, idx) \
((struct tracing_map_elt **)TRACING_MAP_ARRAY_ELT(array, idx))
struct tracing_map {
unsigned int key_size;
unsigned int map_bits;
unsigned int map_size;
unsigned int max_elts;
atomic_t next_elt;
struct tracing_map_array *elts;
struct tracing_map_array *map;
const struct tracing_map_ops *ops;
void *private_data;
struct tracing_map_field fields[TRACING_MAP_FIELDS_MAX];
unsigned int n_fields;
int key_idx[TRACING_MAP_KEYS_MAX];
unsigned int n_keys;
struct tracing_map_sort_key sort_key;
unsigned int n_vars;
atomic64_t hits;
atomic64_t drops;
};
/**
* struct tracing_map_ops - callbacks for tracing_map
*
* The methods in this structure define callback functions for various
* operations on a tracing_map or objects related to a tracing_map.
*
* For a detailed description of tracing_map_elt objects please see
* the overview of tracing_map data structures at the beginning of
* this file.
*
* All the methods below are optional.
*
* @elt_alloc: When a tracing_map_elt is allocated, this function, if
* defined, will be called and gives clients the opportunity to
* allocate additional data and attach it to the element
* (tracing_map_elt->private_data is meant for that purpose).
* Element allocation occurs before tracing begins, when the
Annotation
- Detected declarations: `struct tracing_map_field`, `struct tracing_map_elt`, `struct tracing_map_entry`, `struct tracing_map_sort_key`, `struct tracing_map_sort_entry`, `struct tracing_map_array`, `struct tracing_map`, `struct tracing_map_ops`.
- 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.