scx_next_descendant_pre(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… scx_next_descendant_pre β€” find the next descendant for pre-order walk πŸ‘‘

okay so bestie, welcome to the Kernel API Manual, section 9 (that's the kernel-API girlies section, iykyk). today we're talking about scx_next_descendant_pre(9) and honestly? she's a helper. a little iterator gremlin. and she ate. ✨


🌸 SYNOPSIS 🌸

struct scx_sched * scx_next_descendant_pre (struct scx_sched *pos ,
struct scx_sched *root );

literally just two args, both struct scx_sched *, and she hands you back a struct scx_sched *. no cap. 🫢


πŸŽ€ ARGUMENTS πŸŽ€

  • pos β€” the current position, bestie. and listen β€” you pass NULL to initiate the traversal. that's your "start the walk" button. πŸ’…
  • root β€” the sched whose descendants we're walking. the main character, basically. she owns the whole subtree we're poking around in.

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so this one is explicitly "to be used by scx_for_each_descendant_pre" β€” she's not really a solo act, she's the supporting cast for that macro. the way that she works is: you give her your current position and the root, and she finds the next descendant to visit for a pre-order traversal of root's descendants. 🌈

and here's the important deet, do NOT miss this: root is included in the iteration, and root is the first node to be visited. so like... she's in the group chat too. she's not just the admin who spawned everyone. periodt. πŸ‘‘

pre-order = visit the node, then her descendants. root first, always. don't come for her. πŸ’œ

🧚 SEE ALSO 🧚

okay so the source of truth is the kernel file ./kernel/sched/ext/sub.c, and then there is a whole squad of related functions β€” not me listing all of them, but also yes me listing all of them, because they're iconic and you should know them πŸ’–:

like, that's a roster. the whole scx_bpf_sub_* family showing up together? it's giving family reunion. πŸ”₯


⭐ sign-off ⭐

this page lives in ./kernel/sched/ext, dated October 2026, and yes, the girl herself is scx_next_descendant_pre(9) β€” she said it, we read it, we stan. bye bestie, go walk that tree in pre-order πŸ’…πŸ’–πŸŽ€

πŸ“¦ where this page comes from