-
Notifications
You must be signed in to change notification settings - Fork 553
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
Fix cgroups value types in the spec. #233
Conversation
On Tue, Oct 27, 2015 at 10:59:48AM -0700, Vish Kannan wrote:
This unwinds a lot of type changes from #199. Are we sure we want to |
Unless these field become pointers, I do not see how I can skip these On Tue, Oct 27, 2015 at 11:17 AM, W. Trevor King notifications@github.com
|
On Tue, Oct 27, 2015 at 11:21:02AM -0700, Vish Kannan wrote:
I'm fine with pointers (and I expect Go generated from a protobuf |
ah no. int64 makes more sense here. Pointers is a bit too much complication here. LGTM |
On Tue, Oct 27, 2015 at 01:36:50PM -0700, Vincent Batts wrote:
I'm fine punting this to the protobuf transition (at which point these |
I don't understand why we take -1 as unlimited? What's the intention here? |
@hqhq: Sometimes, we want to use the system defaults for certain cgroups values. The default value of |
@vishh I understand and agree with this intention, but so far there is only |
Without this change, how do you propose that a user will express their intent of using the system defaults? |
@vishh Except exception like |
Requiring to explicitly set If we had to do this, surely a better way would be to set them to |
Hmm. Considering that the Spec is still not v1.0, do we really care about The general issue here is the fact that the Spec is wrapping the linux APIs On Fri, Oct 30, 2015 at 7:07 AM, Aleksa Sarai notifications@github.com
|
On Fri, Oct 30, 2015 at 09:42:51AM -0700, Vish Kannan wrote:
Using pointers in the Go types so ‘null’ and missing are valid JSON |
Ah, fair enough. But there are other reasons why I don't agree with using
TBH, I feel like |
On Fri, Oct 30, 2015 at 05:44:34PM -0700, Aleksa Sarai wrote:
I may be misunderstanding, but it sounds like you're saying: { would mean “don't touch memory.limit_in_bytes”. That makes sense to { through an empty/missing runtime.json would mean “set For example, say the 1.0 spec defines cgroups that are pretty much |
@wking No, I agree with the proposal of using pointers so that using
i was referring specifically to the current state of this PR (using I don't agree this is how it should work, and I'm all for making both setting a value to |
- add information to cgroup resources controllers with examples - add pids cgroup information and example - reflect kernel types Signed-off-by: Antonio Murdaca <runcom@linux.com>
I'm ok with nil for values where the zero value means something for our settings. @vishh what do you think? |
SGTM. On Mon, Nov 9, 2015 at 2:29 PM, Michael Crosby notifications@github.com
|
@crosbymichael Weren't we talking about making all settings have |
All or only the ones that make sense. Its so we don't end up with things like memory swap where you have to set it to -1 if your system does not support it or your containers will fail |
On Mon, Nov 09, 2015 at 05:07:36PM -0800, Michael Crosby wrote:
I think “don't set this value” or “don't create this cgroup” are |
@crosbymichael setting memory swap as |
LGTM |
// MEM to use within the cpuset | ||
Mems string `json:"mems"` | ||
// CPU shares (relative weight (ratio) vs. other cgroups with cpu shares). | ||
Shares *int64 `json:"shares,omitempty"` |
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.
Since these are pointers now, shouldn't we match the kernel data types and have these be unsigned?
If it is nil, it means that we don't touch the value. There is no need for setting these to negative values.
@crosbymichael I'm not a maintainer, but NACK. There are still some issues with types that should be unsigned. |
…mpty` json tag. Signed-off-by: Vishnu kannan <vishnuk@google.com>
Comments addressed |
LGTM |
Fix cgroups value types in the spec.
thanks for doing this @vishh |
The general rule seems to be: If Go's default value has the same semantics we'd use for an unset value, don't bother with a pointer. I'm not sure how well that squares with [1]: We want a consistent way to identify unset settings. But if the falsy values count as "unset", maybe the "null is a consistent identifier for unset" approach was never really viable. I'm also not sure if the new style extends to integers where zero has the same semantics as unset values. It sounds like Michael was ok with no pointers for those values [2], but OOMScoreAdj (where zero clearly means "do nothing") got a pointer in opencontainers#233 [3]. More clarity on the threshold would be nice. [1]: opencontainers#233 (comment) [2]: opencontainers#233 (comment) [3]: https://github.com/opencontainers/specs/pull/233/files#diff-34c30be66233f08b447fb608ea0e66bbR206
The general rule seems to be: If Go's default value has the same semantics we'd use for an unset value, don't bother with a pointer. I'm not sure how well that squares with [1]: We want a consistent way to identify unset settings. But if the falsy values count as "unset", maybe the "null is a consistent identifier for unset" approach was never really viable. I'm also not sure if the new style extends to integers where zero has the same semantics as unset values. It sounds like Michael was ok with no pointers for those values [2], but OOMScoreAdj (where zero clearly means "do nothing") got a pointer in opencontainers#233 [3]. More clarity on the threshold would be nice. [1]: opencontainers#233 (comment) [2]: opencontainers#233 (comment) [3]: https://github.com/opencontainers/specs/pull/233/files#diff-34c30be66233f08b447fb608ea0e66bbR206
The general rule seems to be: If Go's default value has the same semantics we'd use for an unset value, don't bother with a pointer. I'm not sure how well that squares with [1]: We want a consistent way to identify unset settings. But if the falsy values count as "unset", maybe the "null is a consistent identifier for unset" approach was never really viable. I'm also not sure if the new style extends to integers where zero has the same semantics as unset values. It sounds like Michael was ok with no pointers for those values [2], but OOMScoreAdj (where zero clearly means "do nothing") got a pointer in opencontainers#233 [3]. More clarity on the threshold would be nice. [1]: opencontainers#233 (comment) [2]: opencontainers#233 (comment) [3]: https://github.com/opencontainers/specs/pull/233/files#diff-34c30be66233f08b447fb608ea0e66bbR206 Signed-off-by: W. Trevor King <wking@tremily.us>
The general rule seems to be: If Go's default value has the same semantics we'd use for an unset value, don't bother with a pointer. I'm not sure how well that squares with [1]: We want a consistent way to identify unset settings. But if the falsy values count as "unset", maybe the "null is a consistent identifier for unset" approach was never really viable. Qiang points out that pointers are required to opt-out of boolean settings where both true and false would require action [2], so I've worded the exception to only apply when the Go default for the type is expicitly a no-op in the spec. I'm also not sure if the new style extends to integers where zero has the same semantics as unset values. It sounds like Michael was ok with no pointers for those values [3], but OOMScoreAdj (where zero clearly means "do nothing") got a pointer in opencontainers#233 [4]. More clarity on the threshold would be nice; in this commit I've laid out the logic and not explicitly listed the types it applies to. [1]: opencontainers#233 (comment) [2]: https://github.com/opencontainers/specs/pull/317/files#r50932706 [3]: opencontainers#233 (comment) [4]: https://github.com/opencontainers/specs/pull/233/files#diff-34c30be66233f08b447fb608ea0e66bbR206 Signed-off-by: W. Trevor King <wking@tremily.us>
The general rule seems to be: If Go's default value has the same semantics we'd use for an unset value, don't bother with a pointer. I'm not sure how well that squares with [1]: We want a consistent way to identify unset settings. But if the falsy values count as "unset", maybe the "null is a consistent identifier for unset" approach was never really viable. Qiang points out that pointers are required to opt-out of boolean settings where both true and false would require action [2], so I've worded the exception to only apply when the Go default for the type is expicitly a no-op in the spec. I'm also not sure if the new style extends to integers where zero has the same semantics as unset values. It sounds like Michael was ok with no pointers for those values [3], but OOMScoreAdj (where zero clearly means "do nothing") got a pointer in opencontainers#233 [4]. More clarity on the threshold would be nice; in this commit I've laid out the logic and not explicitly listed the types it applies to. [1]: opencontainers#233 (comment) [2]: https://github.com/opencontainers/specs/pull/317/files#r50932706 [3]: opencontainers#233 (comment) [4]: https://github.com/opencontainers/specs/pull/233/files#diff-34c30be66233f08b447fb608ea0e66bbR206 Signed-off-by: W. Trevor King <wking@tremily.us>
Follow up of this comment