bpf_task_under_cgroup(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… bpf_task_under_cgroup(9) β€” kernel API manual, but make it make sense

okay so bestie, this is a page from the Kernel API Manual (that's the manual name, cute) β€” and it's all about one little kfunc that answers a very specific question for you. Let's go πŸŽ€


✨ NAME ✨

bpf_task_under_cgroup β€” the kfunc that wraps task_under_cgroup_hierarchy() for you, so you can test whether a task belongs to a cgroup's ancestry πŸ’–

That's the whole job. It's a vibe check for cgroup family trees, no cap.


🌸 SYNOPSIS 🌸

__bpf_kfunc long bpf_task_under_cgroup (struct task_struct *task ,
struct cgroup *ancestor );

look at her. two pointers, one long. she's iconic and she's not doing extra credit πŸ”₯


πŸ¦‹ ARGUMENTS πŸ¦‹

  • task β€” the task you're testing πŸ‘€ like, the one you're asking about
  • ancestor β€” a possible ancestor of that task's cgroup 🌳 the "is this your grandma" candidate

πŸ’€ DESCRIPTION πŸ’€

so here's the tea β˜•: it tests whether task's default cgroup hierarchy is a descendant of ancestor.

and before you ask β€” yes, it follows all the same rules as cgroup_is_descendant, exactly, no remix, no creative liberties. and important: it only applies to the default hierarchy. default only, bestie, don't come at it with anything else πŸ™ˆ


πŸ‘‘ SEE ALSO πŸ‘‘

this next part is literally the whole group chat, i'm not kidding. all of these are waiting for you in the kernel file ./kernel/bpf/helpers.c:

like i said. the entire group chat. say hi to all of them for me 🫢


sign-off time 🧚 this page lives in ./kernel/bpf, it's dated October 2026, and yeah β€” it's bpf_task_under_cgroup(9) all the way down. mwah πŸ’‹ periodt. ⭐

πŸ“¦ where this page comes from