stack_depot_save(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’Ύ 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 allocation GFP flags. 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 πŸ’–:


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