Skip to content
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

Allow negative value for some resource fields #648

Merged
merged 1 commit into from
Jan 10, 2017

Conversation

hqhq
Copy link
Contributor

@hqhq hqhq commented Jan 5, 2017

Carry #499

For these values, cgroup kernal APIs accept -1 to set
them as unlimited, as docker and runc all support
update resources, we should not set drawbacks in spec.

Signed-off-by: Qiang Huang h.huangqiang@huawei.com

Carry opencontainers#499

For these values, cgroup kernal APIs accept -1 to set
them as unlimited, as docker and runc all support
update resources, we should not set drawbacks in spec.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
@@ -283,15 +283,15 @@ For more information, see [the memory cgroup man page][cgroup-v1-memory].

The following parameters can be specified to setup the controller:

* **`limit`** *(uint64, OPTIONAL)* - sets limit of memory usage in bytes
* **`limit`** *(int64, OPTIONAL)* - sets limit of memory usage in bytes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These properties are not tied directly to their backing cgroup property. I think we should either:

a. Be explicit about the cgroup property which MUST be used to satisfy the configuration (in which case the kernel docs will explain the 0 and -1 cases) or
b. Explicitly define the 0 and -1 cases here.

@tianon
Copy link
Member

tianon commented Jan 5, 2017

LGTM

IMO the additional clarity as to why this is an int64 rather than a uint64 that @wking points out would be excellent as well, but I don't personally think it's a blocker for this PR.

Approved with PullApprove

@crosbymichael
Copy link
Member

crosbymichael commented Jan 9, 2017

LGTM

Approved with PullApprove

@hqhq hqhq merged commit 4b42ec4 into opencontainers:master Jan 10, 2017
@hqhq hqhq deleted the all_negative_value branch January 10, 2017 09:34
hqhq added a commit to hqhq/runtime-spec that referenced this pull request Mar 1, 2017
This partially revert opencontainers#648 , after a second thought, I think we
should use specs value the same as kernel API input, see:
opencontainers#692 (comment)

For memory and hugetlb limits *.limit_in_bytes, cgroup APIs take the values
as string, but the parsed values are unsigned long, see:
https://github.com/torvalds/linux/blob/v4.10/mm/page_counter.c#L175-L193

For `cpu.cfs_quota_us` and `cpu.rt_runtime_us`, cgroup APIs take the input
value as signed long long, while `cpu.cfs_period_us` and `cpu.rt_periof_us`
take the input value as unsigned long long.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants