stack_depot_save(9)
πΎ stack_depot_save(9) β like, the Kernel API Manual but make it make sense
okay bestie, gather round π«Ά this one's from the Kernel API Manual and it's genuinely so useful β it's the function that shoves a stack trace into the stack depot so you can look it up later. iykyk π
β¨ NAME β¨
stack_depot_save β save a stack trace to stack depot π
πΈ SYNOPSIS πΈ
depot_stack_handle_t stack_depot_save (unsigned long *entries , unsigned
int nr_entries , gfp_t alloc_flags );
π¦ ARGUMENTS π¦
entriesβ pointer to the stack trace, bestie. that's the actual stack you're handing over πnr_entriesβ how many frames are in that stack. count 'em, don't guess π₯alloc_flagsβ the allocationGFPflags. the vibe of the allocation, basically β¨
π DESCRIPTION π
so here's the thing that lowkey matters: this does not increment the refcount on the saved stack trace. not even a little. π« for the full deets, go look at stack_depot_save_flags β it's giving main character energy and explains everything.
π CONTEXT π
this is one of those "only in the right context" situations, no cap. you can call it in contexts where allocations via alloc_pages are allowed β¨ β again, stack_depot_save_flags has the full story if you need more π
π RETURN π
you get back the handle of the stack trace stored in the depot π β and 0 on failure π (yes, check it, bestie).
π SEE ALSO π
kernel file ./include/linux/stackdepot.h, plus the whole stack depot friend group π:
stack_depot_save_flags(9)__stack_depot_get_stack_record(9)stack_depot_fetch(9)stack_depot_print(9)stack_depot_snprint(9)stack_depot_put(9)stack_depot_set_extra_bits(9)stack_depot_get_extra_bits(9)
ngl, 0 on failure is so real of it. check your return value, bestie, always. π
and that's the whole page, periodt π
this came out of ./include/linux, dated October 2026, and yes it's literally titled stack_depot_save(9) β slay, go save some stacks π§ββοΈπ
π¦ 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