Skip to main content

resize_cgroup_bw

Function resize_cgroup_bw 

Source
pub fn resize_cgroup_bw(
    open_obj: &mut OpenObject,
    nr_cgrp_max: u32,
    tree_height_max: u32,
    nr_llcs: usize,
) -> Result<()>
Expand description

Size the lib/cgroup_bw (cpu.max) BPF maps for the running system.

Call once between opening and loading the skeleton. A BPF map’s max_entries is fixed at load time, so every runtime-dependent size is set here:

  • nr_cgrp_max caps the number of managed cgroups: it sizes cbw_cgrp_map and the two cgroup-id tables. The caller must mirror it to the nr_cgrp_max rodata so the BPF admission gate matches the map sizes.
  • tree_height_max caps the managed cgroup nesting depth: it sizes tree_levels_map (a per-CPU per-level accumulator). The caller must mirror it to the tree_height_max rodata.
  • nr_llcs sizes cbw_cgrp_llc_map (one entry per LLC per tracked cgroup) to nr_cgrp_max * nr_llcs.