-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
support write multiple items into cgroup v2 file #4182
support write multiple items into cgroup v2 file #4182
Conversation
smileusd
commented
Feb 1, 2024
libcontainer/cgroups/fs2/fs2.go
Outdated
// {"io.max": "252:1 riops=1000 wiops=1000 \n 252:2 riops=2000 wiops=2000"} | ||
items := strings.Split(v, "\n") | ||
for _, item := range items { | ||
if err := cgroups.WriteFile(m.dirPath, k, item); err != nil { |
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.
Just curious, why is this writing two lines instead of overwriting them?
If you had a test case for this, I could have answered myself by looking at that ;)
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.
the cgroup file is also like a map. if the key is the same, the new one will override old one, but if it is different key, like different device number, the will add a new line
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.
Not sure how to add test case at here, there is the test by my environment
root@tess-node-6bg2h:/sys/fs/cgroup/kubepods.slice/kubepods-besteffort.slice/kubepods-besteffort-pod02d6c4d8_0888_464a_9037_7238679d4174.slice# cat io.max
252:0 rbps=1048576 wbps=1048576 riops=100 wiops=100
253:0 rbps=1048576 wbps=1048576 riops=100 wiops=100
root@tess-node-6bg2h:/sys/fs/cgroup/kubepods.slice/kubepods-besteffort.slice/kubepods-besteffort-pod02d6c4d8_0888_464a_9037_7238679d4174.slice# echo "252:16 rbps=1048576 wbps=1048576 riops=100 wiops=100" > io.max
root@tess-node-6bg2h:/sys/fs/cgroup/kubepods.slice/kubepods-besteffort.slice/kubepods-besteffort-pod02d6c4d8_0888_464a_9037_7238679d4174.slice# cat io.max
252:16 rbps=1048576 wbps=1048576 riops=100 wiops=100
252:0 rbps=1048576 wbps=1048576 riops=100 wiops=100
253:0 rbps=1048576 wbps=1048576 riops=100 wiops=100
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.
I added test case in pr @rata
@smileusd perhaps you can set io.max not via unified but via linux.resources.blockIO.weightDevice |
Looks like it is only for io.weight not io.max. And actually cgroup v2 io.weight value range should be [1, 10000] not [10, 1000] So i think that should only for cgroup v1 might. |
This comment was marked as outdated.
This comment was marked as outdated.
caf1cd6
to
c61eeb2
Compare
I'm sorry for pointing your into the wrong setting. What I meant to say is you should use |
Closing in favor of #4186. |