__switch_to(9)
π __switch_to β switching tasks like the main character
okay so bestie, welcome to the Kernel API Manual β¨ this little page is all about __switch_to(9), and honestly? it's giving core scheduling energy π«Ά
πΈ NAME πΈ
__switch_to β switch execution of a task π«
like, literally, it swaps one task out and another one in, no cap.
π SYNOPSIS π
struct task_struct * __switch_to (struct task_struct *prev , struct
task_struct *next , void *sched_ra , void *sched_cfa );
that's the whole signature, keeping it exactly as-is because we do not mess with the facts π
β¨ ARGUMENTS β¨
prevβ the task that was previously executed, aka the one wrapping up its turn πnextβ the task that's about to begin executing, the one stepping into the spotlight πsched_raβ the__schedulereturn address πsched_cfaβ the__schedulecall frame address π
π DESCRIPTION π
so here's the vibe: this function is used whilst scheduling to save the context of prev & load the context of next π₯ it returns prev, fr fr.
that's it. that's the whole glow-up. saving the old context, loading the new one, handing prev back to you π«Ά
π¦ SEE ALSO π¦
- Kernel file
./arch/loongarch/include/asm/switch_to.hβ go read it, iykyk π
π quick reminder bestie:sched_raandsched_cfaare the__schedulereturn address and call frame address respectively β don't forget what they stand for, it's on the quiz π
and that's a wrap, babe π this page lives in ./arch/loongarch/include/asm, from the October 2026 era of the Kernel API Manual β slay, go schedule something iconic π
β¨
π¦ 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