-
Notifications
You must be signed in to change notification settings - Fork 2.3k
add more parameters of blkio subsystem to command line. #1004
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
Conversation
|
Dear maintainers, |
|
Dear maintainers, |
|
Code looks good, can you add some test cases in |
update.go
Outdated
| }, | ||
| cli.StringSliceFlag{ | ||
| Name: "blkio-weight-device", | ||
| Usage: "Weight per cgroup per device, can override BlkioWeight.", |
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.
Can you add the expected input format in there (and the one below)?
29c8d04 to
4e1570d
Compare
|
@mlaventure , thanks for your suggestion, i have added the input style example according to your suggestion. |
|
@hopkings2008 Then I think you can test it on your local machine make sure they all passed, and add check for io scheduler and skip the test case if it's not cfq. |
|
@hopkings2008 I think in the flag description something more generic should be used, for instance:
wdyt? |
1ab9cb1 to
5a004d9
Compare
|
@mlaventure thanks for your good suggestion. I have amended the description of them, please check it again. |
| ctds = append(ctds, td) | ||
| } | ||
| return ctds | ||
| } |
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.
You can use configs.NewWeightDevice and configs.NewThrottleDevice instead of these.
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.
@hqhq Good suggestion, I will amend this. Thanks.
|
@hqhq i have amended the code according to your suggestion, please check it again. thanks. |
update.go
Outdated
| func convertSpecWeightDevices(devices []specs.WeightDevice) []*configs.WeightDevice { | ||
| var cwds []*configs.WeightDevice | ||
| for _, d := range devices { | ||
| wd := configs.NewWeightDevice(d.Major, d.Minor, *d.Weight, *d.LeafWeight) |
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.
According to getBlkioWeightDeviceFromString(), d.LeafWeight could be null, you have to check null condition here.
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.
@hqhq thanks for finding this problem. I have fixed it by checking the nil pointer value. By default, the leafweight will be 0 which does nothing. Please help to check this PR again.
|
Sorry I should've mentioned before, |
|
@hqhq i missed those two related things, and thanks for your reminder. And i have added the missed changes. Please check it again. :) |
|
@mlaventure could you please help to check this PR again? and welcome your suggestions, thanks a lot. |
|
Dear maintainers, Please help to check this PR and after this can be merged, i will submit the PR for related change of containerd. |
man/runc-update.8.md
Outdated
| --blkio-weight value Specifies per cgroup weight, range is from 10 to 1000 (default: 0) | ||
| --blkio-leaf-weight value Specifies tasks' weight in the given cgroup while competing with the cgroup's child cgroups, range is from 10 to 1000, cfq scheduler only | ||
| --blkio-weight-device value Weight per cgroup per device, can override blkio-weight. For example, "<MAJOR>:<MINOR> <WEIGHT> [LEAF_WEIGHT]" | ||
| --blkio-throttle-readbps-device value IO read rate limit per cgroup per device, bytes per second. For example, "<MAJOR>:<MINOR> <RATE>" |
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.
nitpick: s/For example/Argument must be of the form/ or something similar
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.
@mlaventure thanks very much for your good suggestion. I have amended that description and please check it again. thanks
|
@mlaventure could you please help to review this PR again? i have amended the help description message according to your suggestion. Thanks a lot. |
|
Dear maintainers, Could you please check this PR so that i can send my PR for related changes for containerd, and welcome your suggestions. thanks in advance. |
|
@crosbymichael , could you please help to review this PR? and weclome your suggestions. :) |
|
@mlaventure , could you please take some time to check this pr again? it has taken some long time. :) |
cyphar
left a comment
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.
See my comments.
| --blkio-throttle-readbps-device value IO read rate limit per cgroup per device, bytes per second. Argument must be of the form "<MAJOR>:<MINOR> <RATE>" | ||
| --blkio-throttle-writebps-device value IO write rate limit per cgroup per divice, bytes per second. Argument must be of the form "<MAJOR>:<MINOR> <RATE>" | ||
| --blkio-throttle-readiops-device value IO read rate limit per cgroup per device, IO per second. Argument must be of the form "<MAJOR>:<MINOR> <RATE>" | ||
| --blkio-throttle-writeiops-device value IO write rate limit per cgroup per device, IO per second. Argument must be of the form "<MAJOR>:<MINOR> <RATE>" |
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.
You've added all of these flags ...
|
|
||
| # update blkio-leaf-weight | ||
| runc update test_update --blkio-leaf-weight 500 | ||
| check_cgroup_value $CGROUP_BLKIO "blkio.leaf_weight" 500 |
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.
... but only added a test for leaf weight. Is this intentional (meaning, is it possible for us to test the other options as well here)?
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.
@cyphar thanks for checking this PR. For other parameters of blkio, we cannot test them in current CI machine, because it is lack of cfq device in CI machine. What is your suggestion about the device limitation of CI machine?
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 would add the tests as "optional" if possible (at SUSE we run the test suite on SUSE machines, so the tests are useful outside of the CI setup for this repo). But if we're not testing it in the CI then it's not as important (and could wait for a follow-up PR).
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.
@cyphar , currently, the CI tests are wrote with shell framework. If i add the new flags, some tests are not passed due to the "device" problem. I have tried to add the new flags to CI tests by using 'conditional' judgement, but if do so, the code seems very ugly. For example, if i add new flags into 'DATA; section, i will double the 'old flags' twice. I think this is not acceptable. Can I add those new flags into tests later in another PR if the test framework become more flexible?
Welcome your suggestions.
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.
Yeah, we can handle this later I guess. We need to do the test framework improvements for the memory cgroup anyway.
update.go
Outdated
| }, | ||
| cli.IntFlag{ | ||
| Name: "blkio-leaf-weight", | ||
| Usage: "Specifies tasks' weight in the given cgroup while competing with the cgroup's child cgroups, range is from 10 to 1000, cfq scheduler only", |
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.
IMO we should be specifying "ranges" as part of the help docs. Shouldn't these be all listed inside the runtime-spec?
EDIT: I meant to say "shouldn't"
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.
@cyphar , thanks for your checking. I have amended this and uses 'ranges from' instead of "range is from". Please check it again. Thanks.
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.
That's not what I meant. What I meant was that the actual range should not be in the help docs. The ranges are defined by the runtime-spec, not by us.
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.
@cyphar thanks for your explanation, i have amended this pr and removed 'range' information from help messages. Please check it again. Thanks a lot. :)
| func u16Ptr(i uint16) *uint16 { return &i } | ||
|
|
||
| var regBlkioWeightDevice = regexp.MustCompile(`([0-9]+):([0-9]+) ([0-9]+)(?: ([0-9]+))?`) | ||
| var regBlkioThrottleDevice = regexp.MustCompile(`([0-9]+):([0-9]+) ([0-9]+)`) |
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.
Is this format defined in the spec (my guess is yes), and if so please at least comment that it comes from the spec or something so it's a bit more clear. In addition, if it comes from the spec maybe all of these conversion functions should go inside libcontainer/specconv (@hqhq what do you think?).
da28752 to
54d1412
Compare
Signed-off-by: Yu Zou <zouyu7@huawei.com>
|
Needs rebase |
|
Per-device IOPS and weights are supported now, see PR #4775. We did not want to introduce more CLI flags, this can be handled via JSON. |
Signed-off-by: Yu Zou zouyu7@huawei.com