agent: validate hugepage size is supported
before setting a limit, otherwise paths may not be found.
guest supporting different hugepage size is more likely with peer-pods where
podvm may use different flavor.
Fixes:
@@ -252,19 +252,28 @@ fn set_devices_resources(
}
fn set_hugepages_resources(
- _cg: &cgroups::Cgroup,
+ cg: &cgroups::Cgroup,
hugepage_limits: &[LinuxHugepageLimit],
res: &mut cgroups::Resources,
) {
info!(sl!(), "cgroup manager set hugepage");
let mut limits = vec![];
+ let hugetlb_controller = cg.controller_of::<HugeTlbController>();
for l in hugepage_limits.iter() {
+ if hugetlb_controller.is_some() && hugetlb_controller.unwrap().size_supported(&l.page_size)
+ {
let hr = HugePageResource {
size: l.page_size.clone(),
limit: l.limit,
};
limits.push(hr);
+ } else {
+ warn!(
+ sl!(),
+ "{} page size support cannot be verified, dropping requested limit", l.page_size
+ );
+ }
}
res.hugepages.limits = limits;
}
