tracing_map_init(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ¦‹ 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 β€” the tracing_map you 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:


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