mirror of
https://github.com/kata-containers/cgroups-rs.git
synced 2026-08-05 02:13:23 +00:00
Merge pull request #113 from gkurz/fix-hugetlb-limit-in-bytes
Fix HugeTlbController::limit_in_bytes() for v2
This commit is contained in:
+5
-2
@@ -138,8 +138,11 @@ impl HugeTlbController {
|
|||||||
/// Get the limit (in bytes) of how much memory can be backed by hugepages of a certain size
|
/// Get the limit (in bytes) of how much memory can be backed by hugepages of a certain size
|
||||||
/// (`hugetlb_size`).
|
/// (`hugetlb_size`).
|
||||||
pub fn limit_in_bytes(&self, hugetlb_size: &str) -> Result<u64> {
|
pub fn limit_in_bytes(&self, hugetlb_size: &str) -> Result<u64> {
|
||||||
self.open_path(&format!("hugetlb.{}.limit_in_bytes", hugetlb_size), false)
|
let mut file_name = format!("hugetlb.{}.limit_in_bytes", hugetlb_size);
|
||||||
.and_then(read_u64_from)
|
if self.v2 {
|
||||||
|
file_name = format!("hugetlb.{}.max", hugetlb_size);
|
||||||
|
}
|
||||||
|
self.open_path(&file_name, false).and_then(read_u64_from)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get the current usage of memory that is backed by hugepages of a certain size
|
/// Get the current usage of memory that is backed by hugepages of a certain size
|
||||||
|
|||||||
Reference in New Issue
Block a user