Skip to content

Conversation

@hopkings2008
Copy link

Signed-off-by: Yu Zou zouyu7@huawei.com

@hopkings2008
Copy link
Author

Dear maintainers,
Please help to review this PR, and this PR is to add more blkio subsystem parameters according to oci spec.
And seems that the test cannot be started due to "java.io.IOException: remote file operation failed: /home/ubuntu/workspace/runc-PRs at hudson.remoting.Channel@3bdba927:ubuntu (aufs) (i-7ca51ce9): java.io.IOException: Remote call on ubuntu (aufs) (i-7ca51ce9) failed"

@hopkings2008
Copy link
Author

Dear maintainers,
I triggered the jenkins test again, this time, all the tests are passed. So, please help to review this PR, thanks a lot.

@hqhq
Copy link
Contributor

hqhq commented Aug 29, 2016

Code looks good, can you add some test cases in tests/integration/cgroups.bats and tests/integration/update.bats?

update.go Outdated
},
cli.StringSliceFlag{
Name: "blkio-weight-device",
Usage: "Weight per cgroup per device, can override BlkioWeight.",
Copy link
Contributor

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)?

@hopkings2008 hopkings2008 force-pushed the blkio branch 8 times, most recently from 29c8d04 to 4e1570d Compare August 30, 2016 08:40
@hopkings2008
Copy link
Author

@mlaventure , thanks for your suggestion, i have added the input style example according to your suggestion.
@hqhq , thanks for your suggestion, i have added both unit tests and integration test for this PR. But the integration tests failed at '# process_linux.go:291: setting cgroup config for ready process caused "failed to write 8:0 100 to blkio.weight_device: write /sys/fs/cgroup/blkio/runc-update-integration-test/blkio.weight_device: invalid argument"'
After i checked this problem, it seems that it is related to the problem found at '#140'

@hqhq
Copy link
Contributor

hqhq commented Aug 30, 2016

@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.

@mlaventure
Copy link
Contributor

@hopkings2008 I think in the flag description something more generic should be used, for instance:

<MAJOR>:<MINOR> <WEIGHT> [LEAF_WEIGHT] instead of 8:0 800 [200]

wdyt?

@hopkings2008 hopkings2008 force-pushed the blkio branch 8 times, most recently from 1ab9cb1 to 5a004d9 Compare August 31, 2016 05:11
@hopkings2008
Copy link
Author

@mlaventure thanks for your good suggestion. I have amended the description of them, please check it again.
@hqhq i have added unit tests for this PR, and due to the lack of cfq device in CI machine, the tests cannot be added into integration currently. I will added them later.

ctds = append(ctds, td)
}
return ctds
}
Copy link
Contributor

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.

Copy link
Author

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.

@hopkings2008
Copy link
Author

@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)
Copy link
Contributor

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.

Copy link
Author

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.

@hqhq
Copy link
Contributor

hqhq commented Sep 1, 2016

Sorry I should've mentioned before, man/runc-update.8.md and contrib/completions/bash/runc should also be altered.

@hopkings2008
Copy link
Author

@hqhq i missed those two related things, and thanks for your reminder. And i have added the missed changes. Please check it again. :)

@hqhq
Copy link
Contributor

hqhq commented Sep 1, 2016

LGTM, thanks.

Approved with PullApprove

@hopkings2008
Copy link
Author

@mlaventure could you please help to check this PR again? and welcome your suggestions, thanks a lot.

@hopkings2008
Copy link
Author

Dear maintainers, Please help to check this PR and after this can be merged, i will submit the PR for related change of containerd.

--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>"
Copy link
Contributor

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

Copy link
Author

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

@hopkings2008
Copy link
Author

@mlaventure could you please help to review this PR again? i have amended the help description message according to your suggestion. Thanks a lot.

@hopkings2008
Copy link
Author

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.

@hopkings2008
Copy link
Author

@crosbymichael , could you please help to review this PR? and weclome your suggestions. :)

@hqhq
Copy link
Contributor

hqhq commented Sep 7, 2016

LGTM

Approved with PullApprove

@hopkings2008
Copy link
Author

@mlaventure , could you please take some time to check this pr again? it has taken some long time. :)

Copy link
Member

@cyphar cyphar left a 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>"
Copy link
Member

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
Copy link
Member

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)?

Copy link
Author

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?

Copy link
Member

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).

Copy link
Author

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.

Copy link
Member

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",
Copy link
Member

@cyphar cyphar Sep 20, 2016

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"

Copy link
Author

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.

Copy link
Member

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.

Copy link
Author

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]+)`)
Copy link
Member

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?).

@hopkings2008 hopkings2008 force-pushed the blkio branch 2 times, most recently from da28752 to 54d1412 Compare September 26, 2016 07:55
Signed-off-by: Yu Zou <zouyu7@huawei.com>
@AkihiroSuda
Copy link
Member

Needs rebase

@kolyshkin
Copy link
Contributor

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.

@kolyshkin kolyshkin closed this Sep 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants