support write multiple items into cgroup v2 file#4182
support write multiple items into cgroup v2 file#4182smileusd wants to merge 1 commit intoopencontainers:mainfrom
Conversation
smileusd
commented
Feb 1, 2024
| // {"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.
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.
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.
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
|
@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. |