cgroup_ancestor(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… cgroup_ancestor β€” find ancestor of cgroup

okay so bestie, welcome to the cgroup_ancestor(9) page from the Kernel API Manual (9 = kernel API section, iykyk). this one's short and sweet and honestly kind of iconic for it. let's go πŸŽ€


✨ SYNOPSIS ✨

struct cgroup * cgroup_ancestor (struct cgroup *cgrp , int
       ancestor_level );

that's it. two args, one pointer out. we love a low-effort king πŸ‘‘


🫢 ARGUMENTS 🫢

  • cgrp β€” the cgroup you're tryna find the ancestor of. your starting point, your main character 🌸
  • ancestor_level β€” the level of the ancestor you want, and bestie listen: it's counted starting from root. so you're measuring from the top down, not climbing up from wherever you're standing. important distinction, don't @ me πŸ’€

πŸ¦‹ DESCRIPTION πŸ¦‹

so what does it do. it finds the ancestor of your cgroup at the specified level β€” starting from root β€” if it exists, and returns a pointer to it. simple as that πŸ’–

and if cgrp doesn't have an ancestor at ancestor_level? it returns NULL. no ancestor, no pointer, no vibe. that's the whole contract πŸ€·β€β™€οΈ

ngl this is the chill part: it's safe to call as long as cgrp is accessible. that's the only condition, fr fr. keep cgrp alive and reachable and you're slaying ✨

🌈 SEE ALSO 🌈

the kernel file itself lives at ./include/linux/cgroup.h, and it's surrounded by absolute legends β€” go read these too, they're all part of the same cgroup friend group πŸ‘‘


aaaand that's the whole page, bestie. this one ships out of ./include/linux and is dated October 2026 β€” so mark your calendar, screenshot it, frame it, whatever πŸ’… mwah, go find some ancestors, ily πŸ§šπŸ’œ

πŸ“¦ where this page comes from