stack_map_c...te_max_depth(9)
π stack_map_calculate_max_depth(9) β from the Kernel API Manual, bestie π
okay so picture this: you're deep in kernel/bpf, you've got a stack trace, and you need to know exactly how many entries you can cram in there before things get weird. That's literally this function's whole personality. It calculates the maximum allowed stack trace depth, and it does it flawlessly. no notes. β¨
πΈ NAME πΈ
stack_map_calculate_max_depth β calculate maximum allowed stack trace depth. that's it, that's the job, and she ate π
β¨ SYNOPSIS β¨
u32 stack_map_calculate_max_depth (u32 size , u32 elem_size , u64 flags );
look at her. four params, one u32 return, zero drama. π¦
π ARGUMENTS π
sizeβ the size of the buffer / map value, in bytes. she needs to know how much room we're working with, periodt.elem_sizeβ the size of each individual stack trace element. one entry, one lil unit, you get it πflagsβ the BPF stack trace flags, likeBPF_F_USER_STACK,BPF_F_USER_BUILD_ID,...β yes bestie, there are more, the manpage literally says...so don't come for me π
π₯ RETURN π₯
the maximum number of stack trace entries that can be safely stored. safely is doing so much work in that sentence and I respect it β this is your ceiling, your limit, your whole vibe check for how deep you're allowed to go. no cap. π
π¦ SEE ALSO π¦
- the kernel file
./kernel/bpf/stackmap.cβ that's the main character right there, go read her π
lowkey important: if you're out here stuffing more entries than this number into your stack map, that's not slaying, that's not safe. respect the return value fr fr π
and that's the whole page, bestie π«Ά β straight from ./kernel/bpf, dated October 2026, brought to you with love and a lil sparkle βπ§π
π¦ 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