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

runtime: config: linux: add cgroups informations #199

Merged
merged 1 commit into from
Oct 27, 2015

Conversation

runcom
Copy link
Member

@runcom runcom commented Sep 23, 2015

  • add information to cgroup resources controllers with examples
  • add pids cgroup information and example
  • reflect kernel types

I'm submitting this as a first iteration of specifying structures here in the specs so any help/ideas are well accepted for subsequent PRs

Signed-off-by: Antonio Murdaca runcom@linux.com

@runcom runcom force-pushed the rework-runtime-config-linux branch 2 times, most recently from 8e6ac74 to 7ca9693 Compare September 23, 2015 16:34
* **`mount`** the container will have an isolated mount table
* **`ipc`** processes inside the container will only be able to communicate to other processes inside the same container via system level IPC
* **`uts`** the container will be able to have its own hostname and domain name
* **`user`** the container will be able to remap user and group IDs from the host to local users and groups within the container
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd consider just echoing the “isolates” column of namespaces(7) for these entries. For example:

  • ipc isolates System V IPC, POSIX message queues

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, I see this is cut/pasted/reformatted from below. In that case, it's probably best to leave the text as it stands ;).

@wking
Copy link
Contributor

wking commented Sep 23, 2015

I left a number of minor copy-edit suggestion, but overall this looks
great to me :). I'm especially fond of the linkable examples
(e.g. 1).

On Wed, Sep 23, 2015 at 06:01:17AM -0700, Antonio Murdaca wrote:

  • reflect kernel types

This would be good to get right ;). I haven't dug through the kernel
docs/code to double-check your changes (which are mostly int64 →
uint64), but they all sound reasonable to me. I'm suspicious about
int64 → int for Pids.Limit. Does the kernel really use an
implementation-specific size there?

@runcom
Copy link
Member Author

runcom commented Sep 23, 2015

I'm suspicious about
int64 → int for Pids.Limit. Does the kernel really use an
implementation-specific size there?

it's wrong, mistake

@runcom runcom force-pushed the rework-runtime-config-linux branch 3 times, most recently from 6f3600e to 7e4de1b Compare September 27, 2015 12:17
@runcom
Copy link
Member Author

runcom commented Sep 27, 2015

ping @vbatts @crosbymichael @mrunalp

```json
"disableOOMKiller": false
```

#### Memory

`memory` represents the cgroup subsystem `memory` and it's used to set limits on the container's memory use.
Copy link
Contributor

Choose a reason for hiding this comment

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

s/use/usage ?

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

@runcom runcom force-pushed the rework-runtime-config-linux branch from 7e4de1b to c7bc89c Compare September 29, 2015 17:10
@mrunalp
Copy link
Contributor

mrunalp commented Oct 1, 2015

LGTM

@mrunalp
Copy link
Contributor

mrunalp commented Oct 1, 2015

@vishh you want to take a look?


* **`gid`** *(uint32, optional)* - gid of device owner

**`fileMode`**, **`uid`** and **`gid`** are required if **`path`** is given, otherwise not allowed
Copy link
Contributor

Choose a reason for hiding this comment

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

This line needs at least a trailing period, and maybe an end like “and are otherwise not allowed.”

@wking
Copy link
Contributor

wking commented Oct 1, 2015

There are a few ‘cfq’ → ‘CFS’ changes, but those aren't the same thing
[1,2]. I expect block limits should really be CFQ, while CPU limits
should be CFS.

@mrunalp
Copy link
Contributor

mrunalp commented Oct 1, 2015

Yeah, for block it should be CFQ.

@runcom
Copy link
Member Author

runcom commented Oct 1, 2015

Yeah, for block it should be CFQ.

sorry I mixed both valules, will fix

@runcom runcom force-pushed the rework-runtime-config-linux branch from c7bc89c to 55f4b81 Compare October 2, 2015 09:57
- 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>
@runcom runcom force-pushed the rework-runtime-config-linux branch from 55f4b81 to 2ce2c86 Compare October 2, 2015 21:36
@runcom
Copy link
Member Author

runcom commented Oct 2, 2015

Updated PTAL

@wking
Copy link
Contributor

wking commented Oct 2, 2015 via email

@runcom
Copy link
Member Author

runcom commented Oct 27, 2015

is there anything missing here?

@vbatts
Copy link
Member

vbatts commented Oct 27, 2015

LGTM

vbatts added a commit that referenced this pull request Oct 27, 2015
runtime: config: linux: add cgroups informations
@vbatts vbatts merged commit ab4acc0 into opencontainers:master Oct 27, 2015
@runcom runcom deleted the rework-runtime-config-linux branch October 27, 2015 14:52
// Total memory usage (memory + swap); set `-1' to disable swap
Swap int64 `json:"swap"`
Swap uint64 `json:"swap"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Why uint64 here? How can we set it to -1? I'd much rather retain int64 since negative values have special meaning in the kernel for some of these fields.

Copy link
Contributor

Choose a reason for hiding this comment

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

I will send a PR to clean this up.

Copy link
Member Author

Choose a reason for hiding this comment

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

@vishh Pretty sure I went thou the kernel source and checked this can't be negative, but maybe I made some mistakes checking, thanks

Copy link
Member Author

Choose a reason for hiding this comment

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

definitely made a mistake based on the comment :)

wking added a commit to wking/opencontainer-runtime-spec that referenced this pull request Jul 12, 2017
It's backed by memory.oom_control, so this commit moves it in with
the rest of the memory-controller config.

Looking at the history, the initial request landing a setting for this
in the Docker/OCI ecosystem seems to be [1], which added
Cgroup.OomKillDisable.  That commit was carried from libcontainer into
runC [2] where it is now Resources.OomKillDisable [3].  From runC it
was carried into this repo (with some renaming) in [4].  Subsequent
early doc updates landed in [5,6].  In none of those can I find
discussion about why the setting is not already under memory.  I
expect the reason is that the runC structures are flat, so "under
memory" is not a thing there.  But in this spec, resources has
per-controller sub-properties.  The fact that disableOOMKiller
belonged to the memory controller may have been overlooked in [4] and
never revisited until now.

[1]: docker-archive/libcontainer#417
     Subject: cgroups: add support for oom control
[2]: opencontainers/runc@295c708
     Subject: cgroups: add support for oom control
[3]: https://github.com/opencontainers/runc/blob/v1.0.0-rc3/libcontainer/configs/cgroup_unix.go#L113-L114
[4]: opencontainers#51
     Subject: Add Go types for specification
[5]: opencontainers#137
     Subject: Adding cgroups path to the Spec.
[6]: opencontainers#199
     Subject: runtime: config: linux: add cgroups informations

Signed-off-by: W. Trevor King <wking@tremily.us>
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

Successfully merging this pull request may close these issues.

6 participants