-
Notifications
You must be signed in to change notification settings - Fork 18.6k
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
Remove the deprecated '--kernel-memory' option #42854
Conversation
daemon/daemon_unix.go
Outdated
@@ -102,7 +102,7 @@ func getMemoryResources(config containertypes.Resources) *specs.LinuxMemory { | |||
} | |||
|
|||
if config.KernelMemory != 0 { | |||
memory.Kernel = &config.KernelMemory | |||
logrus.Warn("Your kernel does not support kernel memory limit capabilities or the cgroup is not mounted. Limitation discarded.") |
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.
This message seems inaccurate here -- to give this warning, shouldn't it check sysInfo.KernelMemory
first like it did previously? Alternatively, perhaps we don't warn about kernel support at all, given we're going to ignore the container setting entirely?
Just to thread the needle a little bit, this is related to opencontainers/runtime-spec#1093 and opencontainers/runc#2840. |
Yes; also related to opencontainers/runc#3174 (which makes things more complicated) FWIW; I discussed with @aiordache to change this implementation to
I had a draft branch where I started working on this, (master...thaJeztah:remove_kmem_options) which is when I found out that kmem.tcp was not deprecated in the kernel, so runc (and the spec to an extend) had been a bit too optimistic deprecating the options. So now we're in a situation where;
So what's the best approach here?
|
e49e3f2
to
e8b0b4a
Compare
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.
Arf; of course it helps if I actually submit my review 😂
Looks good; some minor nits:
- the first commit message has a typo (
s/KernelMemeory/KernelMemory/
) - perhaps you can squash at least the first two commits (I think those should go together)
- could you add a bullet to https://github.com/moby/moby/blob/master/docs/api/version-history.md to mention the field has been removed from the API and will be ignored for API v1.42 and above?
e85f4cd
to
d3af5ff
Compare
d3af5ff
to
09128b1
Compare
- remove KernelMemory option from `v1.42` api docs - remove KernelMemory warning on `/info` - update changes for `v1.42` Signed-off-by: aiordache <anca.iordache@docker.com>
Signed-off-by: aiordache <anca.iordache@docker.com>
09128b1
to
3acf0b9
Compare
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.
LGTM
@tianon ptal |
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.
Given runc
is now ignoring this value, I'm not sure I understand why we're working so hard to pretend it really is still supported on the older API levels? Wouldn't it be more useful for users to bubble up that it's not going to do anything, even retroactively?
} | ||
if resources.KernelMemory > 0 && !kernel.CheckKernelVersion(4, 0, 0) { | ||
warnings = append(warnings, "You specified a kernel memory limit on a kernel older than 4.0. Kernel memory limits are experimental on older kernels, it won't work as expected and can cause your system to be unstable.") | ||
if !sysInfo.KernelMemory { |
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.
Isn't the change over in pkg/sysinfo/sysinfo_linux.go
deleting the code that sets this value? (So this will never be invoked?)
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.
Ahm, yes, you're right; I mistook that one for the /info
endpoint (which uses that information)
I guess instead, the systemInfo() endpoint would have to be updated to reset the field in the response for API >= 1.42 (and the field to have omitempty
)
moby/api/server/router/system/system_routes.go
Lines 46 to 47 in 0fdd23b
func (s *systemRouter) getInfo(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error { | |
info := s.backend.SystemInfo() |
The main train of thought here was that;
|
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.
Discussed in maintainers meeting -- approach seems fair enough to me. 👍
Need to double check #42854 (comment) - let me do so tomorrow and let you know 😅 |
warnings = append(warnings, "Your kernel does not support kernel memory limit capabilities or the cgroup is not mounted. Limitation discarded.") | ||
resources.KernelMemory = 0 | ||
} | ||
if resources.KernelMemory < linuxMinMemory { |
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.
Looks like this should check if resources.KernelMemory > 0
, otherwise this will produce an error if it's reset above (line 468)
For those arriving here; this was carried, and merged through #43214 |
Ignore the kernel memory option if set in
HostConfig
on container create.We keep the option in the API ( for the
containers/create
and/info
endpoints) until the next API version release but ignore any value it is set to.