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

config-linux: add idle option for container cgroup #1136

Merged
merged 2 commits into from
Apr 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion config-linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@ The following parameters can be specified to set up the controller:
* **`realtimePeriod`** *(uint64, OPTIONAL)* - same as **`period`** but applies to realtime scheduler only
* **`cpus`** *(string, OPTIONAL)* - list of CPUs the container will run in
* **`mems`** *(string, OPTIONAL)* - list of Memory Nodes the container will run in
* **`idle`** *(int64, OPTIONAL)* - cgroups are configured with minimum weight, 0: default behavior, 1: SCHED_IDLE.
Copy link
Member

Choose a reason for hiding this comment

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

I'm getting mixed signals on the actual "type" of this value from torvalds/linux@3040003#diff-1b49efb1a709264f46f4ac518b965e9620acc2f5b928209547313b8dfc9f1286R400 (int) vs torvalds/linux@3040003#diff-1b49efb1a709264f46f4ac518b965e9620acc2f5b928209547313b8dfc9f1286R511 (long) -- it doesn't make a huge difference since the only values are 0 and 1, but I think any future changes/improvements will benefit if we match the kernel's type size from the get go. 😅

Any ideas which one is "canonical" ? (unfortunately I'm not very familiar with the kernel source to be able to parse this diff better than the two conflicting lines I found 🙈)

Copy link
Member

Choose a reason for hiding this comment

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

Doest it support magic values like -1 ? (wondering if it would make it easier to use to use an uintXX if it only supports 0 and 1

Copy link
Member

Choose a reason for hiding this comment

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

The text around it implies that it might someday? It does not currently. Currently it supports 0 and 1. What I'd like to do is make sure the type we choose matches the type the kernel uses, but I guess int64 fits both of C's int and long on all platforms I'm aware of, so I guess it should be plenty. 👍


#### Example

Expand All @@ -372,7 +373,8 @@ The following parameters can be specified to set up the controller:
"realtimeRuntime": 950000,
"realtimePeriod": 1000000,
"cpus": "2-3",
"mems": "0-7"
"mems": "0-7",
"idle": 0
}
```

Expand Down
2 changes: 2 additions & 0 deletions specs-go/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,8 @@ type LinuxCPU struct {
Cpus string `json:"cpus,omitempty"`
// List of memory nodes in the cpuset. Default is to use any available memory node.
Mems string `json:"mems,omitempty"`
// cgroups are configured with minimum weight, 0: default behavior, 1: SCHED_IDLE.
Idle int64 `json:"idle"`
}

// LinuxPids for Linux cgroup 'pids' resource management (Linux 4.3)
Expand Down