tracing_map_init(9)
π¦ tracing_map_init β like, the Kernel API Manual entry, bestie π¦
okay so real talk, this one's from the Kernel API Manual and it's genuinely kind of a big deal if you're into tracing maps (and if you're not, why are you here?? jk ily π).
β¨ NAME β¨
tracing_map_init β allocate and clear a map's tracing_map_elts, that's the whole vibe π
β¨ SYNOPSIS β¨
int tracing_map_init (struct tracing_map *map );
πΈ ARGUMENTS πΈ
mapβ thetracing_mapyou want to initialize. that's it. that's the whole argument list, she's low maintenance π
π DESCRIPTION π
So what does she actually do? She allocates a pool of tracing_map_elts and clears them, and the pool size equals the user-specified size of 2 ** map_bits β internally maintained as should be added to the map with tracing_map_add_sum_field and tracing_map_add_key_field.
β οΈ yeah that sentence is a little mangled in the source, bestie β I'm not gonna lie to you and pretend it says something cleaner. copying it exactly as it stands, no cap π
Then, tracing_map_init should be called next so the array of tracing_map_elts actually gets allocated β the whole point being to avoid allocating anything in the map insertion path. no surprise mallocs mid-hot-path, we simply do not do that here β¨
The user-specified map size reflects the max number of elements requested by the user:
- internally we double that in order to keep the table sparse and keep collisions manageable π«Ά
See tracing_map.h for a description of tracing_map_ops. it's giving required reading, iykyk π
π₯ RETURN π₯
The tracing_map pointer if successful, ERR_PTR if not. so like, check that return value or it's over for you π
π SEE ALSO π
Kernel file ./kernel/trace/tracing_map.c, plus the whole friend group:
tracing_map_update_sum(9)tracing_map_read_sum(9)tracing_map_set_var(9)tracing_map_var_set(9)tracing_map_read_var(9)tracing_map_read_var_once(9)tracing_map_add_sum_field(9)tracing_map_add_var(9)tracing_map_add_key_field(9)tracing_map_insert(9)tracing_map_lookup(9)tracing_map_destroy(9)tracing_map_clear(9)tracing_map_create(9)tracing_map_destroy_sort_entries(9)tracing_map_sort_entries(9)
and that's the page, mwah π this one lives under ./kernel/trace, dated October 2026, and she answers to the name tracing_map_init(9) β go forth and initialize responsibly, bestie π§π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms