css_next_descendant_post(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 css_next_descendant_post(9) β€” Kernel API Manual, but make it make sense 🌸

okay bestie, welcome to the Kernel API Manual page for css_next_descendant_post(9) β€” the traversal helper that finds the next descendant for a post-order walk. It's giving cgroup tree energy, and we're keeping every detail, fr fr. πŸ’–

✨ NAME ✨

css_next_descendant_post β€” find the next descendant for post-order walk

πŸ¦‹ SYNOPSIS πŸ¦‹

struct cgroup_subsys_state * css_next_descendant_post (struct
cgroup_subsys_state *pos , struct cgroup_subsys_state *root );

πŸŽ€ ARGUMENTS πŸŽ€

  • pos β€” the current position, and you pass NULL to initiate traversal. iconic starting move.
  • root β€” the css whose descendants to walk. That's the main character tree, periodt.

πŸ’… DESCRIPTION πŸ’…

This one is meant to be used by css_for_each_descendant_post, okay? Its whole job: find the next descendant to visit for post-order traversal of root's descendants. And yes, root is included in the iteration and is the last node to be visited β€” no cap. πŸ‘‘

While this function requires cgroup_mutex or RCU read locking, it doesn't require the whole traversal to be contained in a single critical section. Also, it isn't necessary to hold onto a reference to pos. This function will return the correct next descendant as long as both pos and cgroup are accessible and pos is a descendant of cgroup. that's the vibe check ✨

If a subsystem synchronizes ->css_online and the start of iteration, a css which finished ->css_online is guaranteed to be visible in the future iterations and will stay visible until the last reference is put. A css which hasn't finished ->css_online or already finished ->css_offline may show up during traversal. It's each subsystem's responsibility to synchronize against on/offlining. pls handle your own on/offlining business, bestie 🫢

lowkey important: the locking caveat is real β€” keep cgroup_mutex or RCU read locking in mind, and don't assume the whole traversal sits inside one critical section. πŸ’€

🌈 SEE ALSO 🌈

Kernel file ./kernel/cgroup/cgroup.c β€” and then the whole friend group:

okay that's the whole list, no skipping, no cap. πŸ“


and that's the page, bestie. source/version: ./kernel/cgroup, date: October 2026 β€” mwah, go walk that tree post-order and slay πŸ’‹βœ¨

πŸ“¦ where this page comes from