scx_tg_knob_sched(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… scx_tg_knob_sched β€” kernel API manual, section 9 πŸŽ€

okay so this one lives in the kernel API manual, section 9 β€” yes bestie, the big scary kernel section, but honestly? this little function is giving "small but mighty" and we're gonna get through it together ✨


πŸ’– NAME πŸ’–

scx_tg_knob_sched β€” the function that figures out which sched is actually gonna receive a task_group's knob updates 🌸

like, when a cgroup's knobs get poked, somebody has to catch those updates, and this is the girl who does the math on who that somebody is. lowkey iconic.


πŸ¦‹ SYNOPSIS πŸ¦‹

struct scx_sched * scx_tg_knob_sched (struct task_group *tg );

one function, one argument, returns a struct scx_sched *. short and sweet, no cap πŸ’…


🌈 ARGUMENTS 🌈

  • tg β€” the task_group you're curious about, bestie. the one we're resolving the sched for 🫢

⭐ DESCRIPTION ⭐

okay so the whole vibe here: knobs of a cgroup belong to the parent. that's the rule. not the cgroup itself, the parent. so when someone goes to set stuff, you don't hand it to the cgroup you're poking β€” you hand it to the parent's sched. main character energy is at the parent level, fr fr.

so what this does is deliver the set_* ops to the parent task_group's sched. and here's the tea β€” that's the same as tg's own sched everywhere, except at a sub-scheduler attach point, where the sub's parent sched is the one that receives them. so it's basically "same same but different" β€” the difference only shows up at that one specific attach point πŸ¦‹

⚠️ watch out: it returns NULL if the parent task_group has no sched. that can happen when the parent's ops.cgroup_init fails while a sub-scheduler is being disabled. so if you get NULL, that's what's up 😭

and the locking lore, because there's always locking lore πŸŽ€:

the callers sit in tg's cgroup file writes holding the ops rwsem read side. that extends scx_tg_sched's file-write argument to the parent's sched read β€” and the reason is honestly kind of elegant: a parent css outlives its children's files ✨ periodt.


πŸ‘‘ SEE ALSO πŸ‘‘

the kernel file ./kernel/sched/ext/ext.c plus this whole entire friend group of manual pages, in the order the original gave them (don't worry, nobody's getting left out πŸ’œ):


and that's the whole page, bestie 🫢 this one ships out of ./kernel/sched/ext and it's dated October 2026 β€” yes, future girl summer πŸ˜­πŸ’€ go forth and resolve those parent scheds, you've got this πŸ’–βœ¨

πŸ“¦ where this page comes from