-
Notifications
You must be signed in to change notification settings - Fork 550
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
config-linux: clarify cgroup requirements #493
Conversation
If `cgroupsPath` is not specified, implementations can define the default cgroup path. | ||
If `cgroupsPath` is | ||
* ... an absolute path (starting with `/`), the implementation MUST take the path to be relative to the cgroup mount point. | ||
* ... a relative path (not starting with `/`), implementations SHOULD take the value to be the suffix of the resulting cgroup path. |
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.
nit: What does resulting cgroup path
mean in this context? Did you mean relative to the cgroups of the runtime process
?
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'm trying to make it not-too restrictive. There's no reason that a runtime has to make it relative to the cgroups of the runtime process. "Should be the suffix" means that it should be the last component in the path (but component is the wrong word since it can container /
).
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.
On Wed, Jun 08, 2016 at 10:07:28PM -0700, Aleksa Sarai wrote:
+* ... a relative path (not starting with
/
), implementations SHOULD take the value to be the suffix of the resulting cgroup path.I'm trying to make it not-too restrictive. There's no reason that a
runtime has to make it relative to the cgroups of the runtime
process. "Should be the suffix" means that it should be the last
component in the path (but component is the wrong word since it can
container/
).
How about:
… MAY interpret the path relative to a runtime-determined location
in the cgroup hierarchy.
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 prefer SHOULD, since I believe a runtime should have a good reason for it to not do that way. But yes, I like that wording better.
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.
On Thu, Jun 09, 2016 at 05:42:57PM -0700, Aleksa Sarai wrote:
+* ... a relative path (not starting with
/
), implementations SHOULD take the value to be the suffix of the resulting cgroup path.I prefer SHOULD, since I believe a runtime should have a good reason
for it to not do that way…
Is which leaf of a random runtime-generated directory you're at all
that important to you? I don't see a lot of space between MAY and
SHOULD 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.
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 then you have the systemd cgroup manager, where you specify a slice (which may not be a new leaf). While this might all change in cgroupv2, currently I'm trying to allow for custom cgroup managers to be compliant as long as they allow "absolute paths mode".
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.
On Thu, Jun 09, 2016 at 10:23:11PM -0700, Aleksa Sarai wrote:
+* ... a relative path (not starting with
/
), implementations SHOULD take the value to be the suffix of the resulting cgroup path.But then you have the systemd cgroup manager, where you specify a
slice (which may not be a new leaf).
Then maybe require a runtime servicing multiple ‘create’ calls with
identical cgroupsPaths to always join the same cgroups (regardless of
the absolute/relative/unset-ness)? That way folks using relative
paths for systemd (or whatever) have some idea of whether they'll be
joining an existing node or creating a new leaf in the hierarchy.
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've tried to resolve this in the latest version (saying that it must be consistent if a value of cgroupsPath is specified). I don't like the wording though, maybe you could help me reword it?
4e7a196
to
e1d173f
Compare
Implementations of the Spec can choose to name cgroups in any manner. | ||
The Spec does not include naming schema for cgroups. | ||
The Spec does not support [split hierarchy][cgroup-v2]. | ||
The Spec does not support the [unified or "default" hierarchy][cgroup-v2]. |
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.
The old wording is “we don't support per-controller paths” for the reasons discussed in cgroup-v2.txt. It's not about limiting the cgroup version. Although you're now the second person I've heard interpret the old wording that way, so we probably want to adjust the wording. I think we do want to support v2 cgroups though, and it may be more clear than I thought if the runtime joins both v1 and v2 cgroups as needed to collect the controllers it wants to join (because a given controller can only be exposed in the v1 or v2 hierarchy, and not in both at once). So if you want to join the devices
controller and that controller's in the v2 hierarchy, you join the appropriate v2 cgroup.
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 it important to have this? Even if it was supported there would be no changes to the spec and this is more of a runtime concern right?
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.
On Fri, Jun 10, 2016 at 11:45:55AM -0700, Michael Crosby wrote:
-The Spec does not support [split hierarchy][cgroup-v2].
+The Spec does not support the [unified or "default" hierarchy][cgroup-v2].is it important to have this? Even if it was supported there would
be no changes to the spec and this is more of a runtime concern
right?
It was added to motivate a single cgroup-path property
vs. per-controller paths 1. I think it's useful to keep the
(informative) motivation documented here (although I think we can
clarify the wording).
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 the thing is that we do support split hierarchies (that's the default on any modern GNU/Linux system). The reason I made this change was because the link text was wrong (cgroupv2 is the exact opposite of a split hierarchy).
I understand the point (cgroupsPath is a single value), but there's something wrong about this sentence when I read it.
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.
On Fri, Jun 10, 2016 at 09:06:48PM -0700, Aleksa Sarai wrote:
I understand the point (cgroupsPath is a single value), but there's
something wrong about this sentence when I read it.
The wording could be improved. My suggestion is 1:
This specification does not support per-controller paths for the
reasons discussed in the [v2 cgroup docs][cgroup-v2].
@cyphar any updates? |
e1d173f
to
cb96d84
Compare
@Mashimiao Thanks for pinging me, I completely forgot about this PR. 😉 @wking There, I've fixed up all of the things you mentioned. PTAL. |
For example, to run a new process in an existing container without updating limits, `resources` need not be specified. | ||
|
||
A runtime MUST at least use the minimum set of cgroup controllers required to fulfil the `resources` settings. | ||
However, a runtime CAN decide to not attach to any additional cgroup controllers supported by the system. |
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 still think we want “fulfil” → “fulfill” (although it looks like that's UK vs. US spelling, so not a big deal) and “supported by the system“ → “”.
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.
ahem UK spelling is clearly superior. 😉
cb96d84
to
219ceaf
Compare
@wking There, I've fixed up all of your concerns I think. |
Some of the wording was a bit clumsy (and incorrect, by conflating different concepts in control groups as "cgroups"). Signed-off-by: Aleksa Sarai <[email protected]>
`cgroupsPath` can be used to either control the cgroup hierarchy for containers or to run a new process in an existing container. | ||
If `cgroupsPath` is: | ||
* ... an absolute path (starting with `/`), the runtime MUST take the path to be relative to the cgroup mount point. | ||
* ... a relative path (not starting with `/`), the runtime MUST create a new leaf in the cgroup hierarchy and MAY interpret the path relative to a runtime-determined location in the cgroup hierarchy. |
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.
“MUST create a new leaf” conflicts with the later “…MUST consistently attach to the same place …” (see also here). Now that we have the consistently-attach wording, I'm ok with weaker wording like this, and don't really care about MAY vs. SHOULD.
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.
What about something like:
* ... a relative path (not starting with `/`), the runtime MUST create a new leaf in the cgroup unless the same lexical path is used by another existing container [and MAY interpret the path relative to a runtime-determined location in the cgroup hierarchy].
Where "existing" means that it has been at least created. I'm not sure what wording to use there. I can drop the "must create a new leaf" -- but you're the one who suggested it and I do agree with the sentiment somewhat. But maybe we should drop it -- I think consistency is far more important than whether it's a new leaf.
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.
On Fri, Jul 22, 2016 at 02:15:25AM -0700, Aleksa Sarai wrote:
I can drop the "must create a new leaf" -- but you're the one who
suggested it and I do agree with the sentiment somewhat. But maybe
we should drop it -- I think consistency is far more important than
whether it's a new leaf.
I think we should drop the new-leaf wording. I'd suggested it before
we had the consistency wording.
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.
Sure. Fixed.
219ceaf
to
19c2a92
Compare
* ... an absolute path (starting with `/`), the runtime MUST take the path to be relative to the cgroup mount point. | ||
* ... a relative path (not starting with `/`), the runtime MAY interpret the path relative to a runtime-determined location in the cgroup hierarchy. | ||
* ... not specified, the runtime CAN define the default cgroup path. | ||
Runtimes CAN consider certain `cgroupsPath` values to be invalid, and MUST generate an error if this is the case. |
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” → “MAY”. RFC 2119 does not define CAN. And you probably want to drop the comma.
19c2a92
to
4ed839e
Compare
Clarify some of the confusion with cgroupsPath. Due to systemd, we cannot require that relative paths be treated in any specific way. In addition, add a line stating that not all values of cgroupsPath are required to be valid (and that runtimes must error out if they have an invalid cgroup path). However, any given value of cgroupsPath should provide consistent results. Signed-off-by: Aleksa Sarai <[email protected]>
Make explicit that runtimes only have to attach to the bare minimum number of cgroups in order to fulfil the users' requirements. However, runtimes are of course allowed to attach to more than the bare minimum. Signed-off-by: Aleksa Sarai <[email protected]>
The example section looks very sparse otherwise. Signed-off-by: Aleksa Sarai <[email protected]>
@wking Addressed the rest of your comments. |
/cc @opencontainers/runtime-spec-maintainers |
This helps clear up some of the vagueness around cgroupsPath in the spec. It's
loosely modeled on what runC does (as well as allowing for custom cgroup
managers in runtimes). I also updated the cgroup section to make it clear that
lazy cgroup setup (where you only attach to the bare minimum of requested
cgroups) is allowed under the spec. This all originated from an IRC discussion
on #opencontainers.
This possibly obsoletes #270 (although that has some renaming going on).
Signed-off-by: Aleksa Sarai [email protected]
/cc @opencontainers/runtime-spec-maintainers @wking