Skip to content

enable cgroups memory.oom_control#11034

Merged
thaJeztah merged 1 commit intomoby:masterfrom
HuKeping:oom_kill_disable
May 4, 2015
Merged

enable cgroups memory.oom_control#11034
thaJeztah merged 1 commit intomoby:masterfrom
HuKeping:oom_kill_disable

Conversation

@HuKeping
Copy link
Copy Markdown
Contributor

This PR is related to #11026

closes #11026

@hqhq
Copy link
Copy Markdown
Contributor

hqhq commented Feb 26, 2015

You shouldn't add libcontainer changes here, do it in libcontainer project.

@hqhq
Copy link
Copy Markdown
Contributor

hqhq commented Feb 26, 2015

Conflict with #10298 , better hold a while for now :)

Comment thread pkg/sysinfo/sysinfo.go Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

memory.oom_control is with memory cgroup, I think it is not needed to check this file separately.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yes, this check is redundancy :), but it is a little wired we make sysInfo.OomKillDisable= true without doing anything.

@HuKeping
Copy link
Copy Markdown
Contributor Author

I've added it in libcontainer, but it seems libcontainer in docker/docker is far behind the one in docker/libcontainer

@HuKeping
Copy link
Copy Markdown
Contributor Author

@hqhq updated, and this PR needs docker-archive/libcontainer#417 to be merged.

@HuKeping
Copy link
Copy Markdown
Contributor Author

HuKeping commented Mar 9, 2015

updated and docker-archive/libcontainer#417 merged.

Since the docker/docker's libcontainer has not changed yet, this PR will fail for build :(

@HuKeping
Copy link
Copy Markdown
Contributor Author

@hqhq , As #10298 , you said "Cgroup resources are host dependent, they should be in hostConfig."

Do you think this oom_control should also be in hostConfig?

@hqhq
Copy link
Copy Markdown
Contributor

hqhq commented Mar 18, 2015

Yes, of course it is, all cgroup related configs are host dependent, because different hosts could have different cgroup subsystems mounted.

@HuKeping
Copy link
Copy Markdown
Contributor Author

updated as @hqhq 's advice.
Since the change on libcontainer has been merged into docker, I think this PR can be reviewed now.
ping @jfrazelle @icecrime @crosbymichael @LK4D4

@HuKeping
Copy link
Copy Markdown
Contributor Author

ping @icecrime @jamtur01

@LK4D4
Copy link
Copy Markdown
Contributor

LK4D4 commented Mar 19, 2015

@HuKeping The main problem that soon there won't be execdriver. We're working on it now and then you'll be able to rebase your changes on top.

Comment thread runconfig/hostconfig.go Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should not add it here, all these codes below if job.EnvExists("HostConfig") is for backward compatibility, the new comings should always in HostConfig in json, or it won't work. We should lead users to use it the right way.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is not in the if job.EnvExists block

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You got me wrong, normally ContainerHostConfigFromJob should be as simple as just return job.GetenvJson("HostConfig", &hostConfig), all other codes are for backward compatibility, because we didn't have hostConfig at the first time.
For the new fields put into hostConfig, users should only use them through hostConfig, so if users want to use it, there would always have HostConfig env, and we can get the field from it, so you don't need to job.GetenvBool("OomKillDisable").

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah you are right.

@hqhq
Copy link
Copy Markdown
Contributor

hqhq commented Mar 24, 2015

You need to add docs as well.

@hqhq
Copy link
Copy Markdown
Contributor

hqhq commented Mar 26, 2015

As I said you need docs updated, new options always need docs, you can take #11802 as an example.
But I think both of us need to wait for the execdriver change as @LK4D4 said.

@HuKeping
Copy link
Copy Markdown
Contributor Author

OK, docs will come soon

@icecrime
Copy link
Copy Markdown
Contributor

icecrime commented Apr 2, 2015

Although execdriver is meant to be removed, I think we can proceed reviewing this PR until it is. I'm pushing to 2-needs-code-review.

@LK4D4
Copy link
Copy Markdown
Contributor

LK4D4 commented Apr 14, 2015

LGTM
but needs rebase

Comment thread daemon/create.go Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No need for this \n I think.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

sure

@cpuguy83
Copy link
Copy Markdown
Member

cpuguy83 commented May 1, 2015

LGTM moving to docs review

@jamtur01
Copy link
Copy Markdown
Contributor

jamtur01 commented May 1, 2015

Docs LGTM ping @moxiegirl @fredlf @SvenDowideit @thaJeztah

@thaJeztah
Copy link
Copy Markdown
Member

The docs so far look good, but some info has to be added to the Run reference that has a section on constraining Memory.

@HuKeping
Copy link
Copy Markdown
Contributor Author

HuKeping commented May 2, 2015

@thaJeztah updated

Comment thread docs/sources/reference/run.md Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should be the same text as the other documents;

--oom-kill-disable=true|false: Whether to disable OOM Killer for the container or not.

@HuKeping
Copy link
Copy Markdown
Contributor Author

HuKeping commented May 3, 2015

Thanks for @thaJeztah advise, updated.

@thaJeztah
Copy link
Copy Markdown
Member

Thanks! Could you put the --oom-kill-disable and -m/--memory flags in back-ticks? (` ``) then LGTM a

@jamtur01 @moxiegirl @fredlf @SvenDowideit PTAL for the added docs

@HuKeping
Copy link
Copy Markdown
Contributor Author

HuKeping commented May 3, 2015

@thaJeztah updated

Comment thread docs/sources/reference/run.md Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Based on the reference you wrote, I expected to see:

$ docker run -ti -m 100M --oom-kill-disable=true ubuntu:14.04 /bin/bash

Why is that =true (or false) missing here?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It's because of the (IMO) confusing way that Boolean flags are documented. Basically, --enable-foo=true is the same as --enable-foo, and --enable-foo=false is the same as not setting the --enable-foo flag. For more info, see #9406.

In general, you don't actually add the true/false value, even though you can.
If you're okay with not documenting the =true|false here, I'd be +1, but it would be inconsistent with other parts of the docs 😞

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'd like to +1 for just --oom-kill-disable

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@thaJeztah I was afraid of this; wow, I think that is confusing even without the lemon drops I've been drinking. Uh, ok. I'll tweak my comments. We do need to fix this though, I think you are right.

@HuKeping
Copy link
Copy Markdown
Contributor Author

HuKeping commented May 4, 2015

hi @moxiegirl updated as your advise but not use the =true, hope this is OK to you

Add cgroup support for disable OOM killer.

Signed-off-by: Hu Keping <[email protected]>
@moxiegirl
Copy link
Copy Markdown
Contributor

Thanks for the work @HuKeping. LGTM

@thaJeztah
Copy link
Copy Markdown
Member

Thanks @HuKeping LGTM

thaJeztah added a commit that referenced this pull request May 4, 2015
@thaJeztah thaJeztah merged commit ac324e5 into moby:master May 4, 2015
@HuKeping HuKeping deleted the oom_kill_disable branch May 5, 2015 01:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

oom_kill_disable