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

How to set rlimit value to unlimited #692

Closed
sak0 opened this issue Feb 16, 2017 · 8 comments
Closed

How to set rlimit value to unlimited #692

sak0 opened this issue Feb 16, 2017 · 8 comments
Milestone

Comments

@sak0
Copy link

sak0 commented Feb 16, 2017

opencontainers/runc#1283

runtime should be support type for "RLIMI_INFINITY" ?

@wking
Copy link
Contributor

wking commented Feb 16, 2017 via email

@mrunalp mrunalp added this to the 1.0.0 milestone Feb 22, 2017
@mrunalp
Copy link
Contributor

mrunalp commented Feb 22, 2017

RLIM_INFINITY is defined as unsigned long in the kernel. See https://github.com/torvalds/linux/search?utf8=%E2%9C%93&q=RLIM_INFINITY so one should be able to set it today.

@hqhq
Copy link
Contributor

hqhq commented Feb 23, 2017

Yes kernel defines RLIM_INFINITY as unsigned long, we should use the same value otherwise people won't be able to set values larger than MaxInt64 but smaller than MaxUint64. Regarding set to unlimited, since kernel defines RLIM_INFINITY = ~0UL (some architectures might override it), there is no real unlimited value but setting it as a very large one, so users can always set it by themselves, with the fact that:

uint64(-1) = 18446744073709551615
int64(18446744073709551615) = -1

people can still use -1 to set it as unlimited when update as long as we do this forced conversion in runtime before generating the config. In this case, upper level tools need to define this value as int64, but this limitation should be introduced by upper level tools when they see fit, not by spec.

I'm thinking maybe we should revert #648 , types should always be the same as kernel's, we can only change cfs_quota_us as #499 suggested since the kernel type is signed long long and takes -1 as a real unlimited setting.

@crosbymichael @mrunalp @dqminh @tianon WDYT?

@crosbymichael
Copy link
Member

@hqhq ya, that sounds good to me

@mrunalp
Copy link
Contributor

mrunalp commented Feb 28, 2017 via email

hqhq added a commit to hqhq/runtime-spec that referenced this issue 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>
@hqhq
Copy link
Contributor

hqhq commented Mar 1, 2017

@crosbymichael @mrunalp I pushed #704 to address concerns in my comments, I think we can close this issue and conclude that people can use RLIMI_INFINITY or -1 in upper level tools to denote the value as unlimited, but the generated value for specs should always be uint64. Same applies to *.limit_in_bytes.

@crosbymichael
Copy link
Member

crosbymichael commented Mar 1, 2017

ok, i see, its just a weird cast that we have to do for the conversion

@crosbymichael
Copy link
Member

We just merged @hqhq pr so this can be closed.

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

No branches or pull requests

5 participants