scx_bpf_locked_rq(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… scx_bpf_locked_rq(9) β€” a Kernel API Manual moment

okay bestie, so this is page scx_bpf_locked_rq(9) from the Kernel API Manual, and it's honestly a little diva: one function, one job, zero drama (mostly). let's get into it ✨


πŸŽ€ NAME πŸŽ€

scx_bpf_locked_rq β€” returns the rq that SCX currently has locked. that's it. that's the whole assignment. πŸ‘‘


πŸ¦‹ SYNOPSIS πŸ¦‹

__bpf_kfunc struct rq * scx_bpf_locked_rq (const struct bpf_prog_aux
*aux );

look at her. beautiful. __bpf_kfunc, returns a struct rq *, takes exactly one arg. no cap, that's the whole signature πŸ’–


🌸 ARGUMENTS 🌸

  • aux β€” this is the implicit BPF argument that lets you poke at bpf_prog_aux, and it's hidden from BPF progs. so like… it's there, it's required, but it's not for you, babe. it's giving backstage pass you're not supposed to use πŸ™ˆ

✨ DESCRIPTION ✨

so here's the tea: if a rq lock is currently held by SCX, this bad boy returns the rq. slay. that's your pointer, go be free 🫢

but if no rq lock is being held by SCX? it emits an error and returns NULL. not me getting a NULL handed to me with an error attached 😭 so check that return value, bestie, fr fr. NULL is not a vibe, it's a warning sign.

lowkey important: no lock held by SCX = error + NULL. don't dereference that. periodt. πŸ’€

πŸ’œ SEE ALSO πŸ’œ

it lives in the kernel file ./kernel/sched/ext/ext.c, and it rolls with a massive friend group. the whole sched_ext extended family, in original order, because I would never do them dirty:

like, that is a stacked friend group. iykyk 🌈


and that's the page!! mwah πŸ’‹ this one came from ./kernel/sched/ext, dated October 2026 β€” screenshot it, cite it, tell your friends, go read the other ninety pages, love u bye πŸ§šπŸ’œπŸŒ»

πŸ“¦ where this page comes from