KFunc scx_bpf_task_cgroup
This function returns the sched cGroup of a task.
Definition
p->sched_task_group->css.cgroup
represents the cgroup p
is associated with from the scheduler's POV. SCX operations should use this function to determine p
's current cgroup as, unlike following p->cgroups
, p->sched_task_group
is protected by p
's rq lock and thus atomic w.r.t. all rq-locked operations. Can be called on the parameter tasks of rq-locked operations. The restriction guarantees that p
's rq is locked by the caller.
Parameters
p
: task of interest
Returns
The sched cGroup of a task
Signature
struct cgroup *scx_bpf_task_cgroup(struct task_struct *p)
Note
This kfunc returns a pointer to a refcounted object. The verifier will then ensure that the pointer to the object
is eventually released using a release kfunc, or transferred to a map using a referenced kptr
(by invoking bpf_kptr_xchg
). If not, the verifier fails the
loading of the BPF program until no lingering references remain in all possible explored states of the program.
Usage
Docs could be improved
This part of the docs is incomplete, contributions are very welcome
Program types
The following program types can make use of this kfunc:
Example
Docs could be improved
This part of the docs is incomplete, contributions are very welcome