-
Notifications
You must be signed in to change notification settings - Fork 346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for rsvd hugetlb cgroup #2719
Conversation
I can also open up a PR in oci-spec-rs if necessary to update info about huge-tlb limits. |
Let's do it. |
Hey, sorry for the delay. Opened up a corresponding PR in oci-spec-rs repo as well. |
@omprakaash May I ask you to add a e2e test? |
Oh yes ! Will add one. |
Hey, do we need a oci-spec release and update its version in this PR ? |
@omprakaash friendly remind ;) |
If needed, I can do it. |
274287d
to
4e2a9cb
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #2719 +/- ##
==========================================
+ Coverage 65.21% 65.47% +0.25%
==========================================
Files 133 133
Lines 16981 17099 +118
==========================================
+ Hits 11074 11195 +121
+ Misses 5907 5904 -3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
crates/libcgroups/src/v1/hugetlb.rs
Outdated
let _ = common::write_cgroup_file( | ||
root_path.join(format!( | ||
"hugetlb.{}.rsvd.limit_in_bytes", | ||
hugetlb.page_size() | ||
)), | ||
hugetlb.limit(), | ||
); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please take care of Result
type.
let _ = common::write_cgroup_file( | |
root_path.join(format!( | |
"hugetlb.{}.rsvd.limit_in_bytes", | |
hugetlb.page_size() | |
)), | |
hugetlb.limit(), | |
); | |
common::write_cgroup_file( | |
root_path.join(format!( | |
"hugetlb.{}.rsvd.limit_in_bytes", | |
hugetlb.page_size() | |
)), | |
hugetlb.limit(), | |
)?; | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I ignored the result because the desired behavior was falling back to just writing to the non-rsvd file if the rsvd file was not present.
crates/libcgroups/src/v1/hugetlb.rs
Outdated
|
||
let usage_file = format!("hugetlb.{page_size}.usage_in_bytes"); | ||
let usage_content = common::read_cgroup_file(cgroup_path.join(usage_file))?; | ||
let mut rsvd = ".rsvd"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about this?
let mut rsvd = ".rsvd"; | |
let mut file_prefix= format!("hugetlb.{page_size}.rsvd"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh that is better, will change it.
crates/libcgroups/src/v2/hugetlb.rs
Outdated
let _ = common::write_cgroup_file( | ||
root_path.join(format!("hugetlb.{}.rsvd.max", hugetlb.page_size())), | ||
hugetlb.limit(), | ||
); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let _ = common::write_cgroup_file( | |
root_path.join(format!("hugetlb.{}.rsvd.max", hugetlb.page_size())), | |
hugetlb.limit(), | |
); | |
common::write_cgroup_file( | |
root_path.join(format!("hugetlb.{}.rsvd.max", hugetlb.page_size())), | |
hugetlb.limit(), | |
)?; | |
crates/libcgroups/src/v2/hugetlb.rs
Outdated
let events_file = format!("hugetlb.{page_size}.events"); | ||
let path = cgroup_path.join(events_file); | ||
let events = common::read_cgroup_file(&path)?; | ||
let mut rsvd = ".rsvd"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as comment in cgroup v1.
@omprakaash It looks like the unit test failed. Please check it |
Oh that is because the functions fails if the write to the new rsvd file fails. If rsvd is not supported, I think we should fallback to just writing to the non-rsvd file (https://github.com/opencontainers/runtime-spec/pull/1116/files). I left a follow up comment in the code review - review |
These unit tests use temporary dirs( |
Hey, sorry I might be misunderstanding, but that is what the newly added tests do (eg: |
@omprakaash But there are possibilities of errors except for what you expect when writing the cgroup file, so we can't ignore this result.
How about checking if the rvsd is supported before writing rvsd's cgroup file? |
Gotcha, changed it so that we first check if the rsvd file exists before attempting to write into it. |
Signed-off-by: omprakaash <[email protected]> Signed-off-by: om <[email protected]> Signed-off-by: Om Prakaash <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍 Thanks, @omprakaash
Adds support for rsvg hugetlb cgroup. More Info on why this is necessary: opencontainers/runtime-spec#1116. Should fix #1707.