ftrace_test...sion_trylock(9)
π ftrace_test_recursion_trylock β Kernel API Manual π
okay bestie, grab a matcha because we're diving into the kernel's recursion detector β¨ this one lives in the Kernel API Manual and it's genuinely iconic for anyone writing ftrace callbacks π¦
β¨ NAME β¨
ftrace_test_recursion_trylock β literally just tests for recursion in the same context, no cap π
πΈ SYNOPSIS πΈ
int ftrace_test_recursion_trylock (unsigned long ip , unsigned long parent_ip );
π ARGUMENTS π
ipβ honestly?-- undescribed --π the manual page itself said nothing about this one, so that's all we've got, bestie πparent_ipβ also-- undescribed --π two mysterious lil parameters living their main character lives, fr fr
π¦ DESCRIPTION π¦
so here's the vibe: use this for ftrace callbacks π this will detect if the function tracing recursed in the same context β like, normal vs interrupt π
that's the whole thing. recursion? in this context? it clocks it. periodt π
π₯ RETURN π₯
-1if a recursion happened π (she found one)>= 0if no recursion β¨ (we're chill, we're slaying, we're fine)
π SEE ALSO π
- Kernel file
./include/linux/trace_recursion.hβ the source of truth, go read it π«Ά ftrace_test_recursion_unlock(9)β the other half of the duo, you'll want her too πΈ
and that's the whole page, bestie π§ from the Kernel API Manual, courtesy of that one path ./include/linux, dated October 2026 β mwah, go forth and trace responsibly πππ
π¦ 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