__ct_user_exit(9)
π __ct_user_exit(9) β the kernel API manual, bestie edition β¨
okay so you're reading a page from the Kernel API Manual (yes, section 9, the fun one) and the star of the show is __ct_user_exit. Buckle up π
πΈ NAME πΈ
__ct_user_exit β the little function that tells context tracking "hey bestie, the CPU is leaving user or guest mode and coming back into the kernel" π«
β¨ SYNOPSIS β¨
void noinstr __ct_user_exit (enum ctx_state state );
like that's it. that's the whole signature. short, iconic, no notes π
π¦ ARGUMENTS π¦
stateβ the userspace context-tracking state you're currently exiting from. that's the whole vibe check for this parameter π
π₯ DESCRIPTION π₯
okay so listen closely because the ordering here is not a suggestion, it's the whole point π
You must call this function after we've entered the kernel from user or guest space, and before any use of an RCU read side critical section. Like, the sequencing is the main character here β get it wrong and everybody's gonna have a bad time π
"any use of RCU read side critical section" is doing a lot of lifting, and it potentially includes any high level kernel code, like:
- syscalls
- exceptions
- signal handling
- etc... (you get the picture, the whole crew π«Ά)
Also, this call supports re-entrancy β which lowkey slays because it means you can call it from any exception handler without needing to know whether we came from userspace or not. no detective work required, it just handles it π β¨
β SEE ALSO β
peep the kernel file ./kernel/context_tracking.c β it's the home base for all of this π and while you're there, check out its friends:
ct_nmi_exit(9)ct_nmi_enter(9)ct_idle_enter(9)ct_idle_exit(9)ct_irq_enter(9)ct_irq_exit(9)__ct_user_enter(9)user_enter_callable(9)user_exit_callable(9)
the whole enter/exit family tree, one big happy context-tracking household ππ
ngl the whole thing lives under ./kernel and this page is dated October 2026 β so yeah, that's the source and the date, consider them mentioned bestie ππ
hope that cleared it up, go forth and track your contexts 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