Skip to main content

setup_cgroup_bw

Function setup_cgroup_bw 

Source
pub fn setup_cgroup_bw(
    open_obj: &mut OpenObject,
    set_bw_prog_name: &str,
) -> Result<CgroupBwSupport>
Expand description

Detect kernel cpu.max support for lib/cgroup_bw and configure the library accordingly. Call once between opening and loading the skeleton; set_bw_prog_name is the name of the scheduler’s cgroup_set_bandwidth callback program.

All three tiers are handled here: on Unsupported the callback is disabled in the struct_ops map; on Sleepable the callback is marked BPF_F_SLEEPABLE and the library’s bw_set_sleepable rodata flag is set together (the flag makes the sleepable kfuncs loadable and the const makes the verifier keep that path, so neither is valid without the other); on Reserved nothing is changed. The caller only needs the returned tier if it wants to log or branch on it.