move_task_between_dsqs(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… move_task_between_dsqs(9) β€” from the Kernel API Manual, bestie

okay so picture this: you're deep in the scheduler, and a task is just sitting in the wrong DSQ. like, wrong vibe entirely. this page is the glow-up tutorial for moving it. no cap. it's a 9 (kernel API) page, and yes the manual is literally just called Kernel API Manual because we keep it simple and iconic ✨


🌸 NAME 🌸

move_task_between_dsqs β€” move a task from one DSQ to another. that's it. that's the whole thing. slay πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

struct rq * move_task_between_dsqs (struct scx_sched *sch , struct
task_struct *p , u64 enq_flags , struct scx_dispatch_q *src_dsq , struct
scx_dispatch_q *dst_dsq );

look at that return type. struct rq *. that's gonna matter later, so don't skip the description, bestie, i'm begging πŸ™ˆ


πŸ¦‹ ARGUMENTS πŸ¦‹

  • sch β€” the scx_sched we're operating on. the main character, fr fr πŸ‘‘
  • p β€” the target task. the one we're moving. it's giving "new school, new me"
  • enq_flags β€” straight up SCX_ENQ_* flags. iconic little flags. pass them exactly as specified πŸŽ€
  • src_dsq β€” the DSQ that p is currently on. and heads up: this must not be a local DSQ. like, that's a hard no 🚫
  • dst_dsq β€” the DSQ p is being moved to. this one can be any DSQ. the world is its oyster 🌈

✨ DESCRIPTION ✨

okay so the rules of the road, and the first one is non-negotiable:

you must call this with p's task_rq and src_dsq locked. like actually. both. locked. that's the vibe check and you need to pass it.

now, here's the plot twist: if dst_dsq is a local DSQ and p is on a different CPU, then p will be migrated, and thus its task_rq will change. 😭 so the thing you locked? yeah. it's not the thing anymore. character development.

but β€” and this is the slay part β€” because p's task_rq is locked, this function doesn't need to use the holding_cpu mechanism. we simply do not require it. periodt.

then, on return: src_dsq is unlocked, and only p's new task_rq (which is the return value) is locked. so like, keep your eyes on that return value, bestie. it's the whole point 🫢


🌟 SEE ALSO 🌟

kernel file ./kernel/sched/ext/ext.c, plus literally the entire friend group:


πŸ’€ real talk though: lock p's task_rq and src_dsq before you call this, and remember src_dsq can't be a local DSQ. do not freestyle this one.

okay that's the whole page, go be great πŸ’– this lil' slice of the manual lives under ./kernel/sched/ext, dated October 2026, and it's filed as move_task_between_dsqs(9) β€” love her, she ate, no notes πŸŽ€βœ¨πŸŒΈ

πŸ“¦ where this page comes from