Skip to main content

resize_cgroup_bw_llc_map

Function resize_cgroup_bw_llc_map 

Source
pub fn resize_cgroup_bw_llc_map(
    open_obj: &mut OpenObject,
    nr_llcs: usize,
) -> Result<()>
Expand description

Size the cpu.max per-(cgroup, LLC) context map to the running system.

cbw_cgrp_llc_map holds one entry per LLC for each tracked cgroup. Its BPF definition ships with a single-LLC default (CBW_NR_CGRP_MAX entries) because a BPF map’s max_entries is fixed at load time while the LLC count is only known at runtime. Call this once after opening and before loading the skeleton to grow it to <cgroup cap> * nr_llcs.

The cgroup cap is read from the sibling cbw_cgrp_map, so the CBW_NR_CGRP_MAX constant stays defined only in the BPF source.