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 CFS bandwidth burst #1120

Merged
merged 1 commit into from
Jan 23, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions config-linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,9 @@ The following parameters can be specified to set up the controller:

* **`shares`** *(uint64, OPTIONAL)* - specifies a relative share of CPU time available to the tasks in a cgroup
* **`quota`** *(int64, OPTIONAL)* - specifies the total amount of time in microseconds for which all tasks in a cgroup can run during one period (as defined by **`period`** below)
If specified with any (valid) positive value, it MUST be no smaller than `burst` (runtimes MAY generate an error).
* **`burst`** *(uint64, OPTIONAL)* - specifies the maximum amount of accumulated time in microseconds for which all tasks in a cgroup can run additionally for burst during one period (as defined by **`period`** below)
giuseppe marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

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

This feature borrows time now against the future underrun ...

Given this, I don't think "accumulated" is the right choice of word here -- this feature is about borrowing from the future, not accumulating from the past:

Suggested change
* **`burst`** *(uint64, OPTIONAL)* - specifies the maximum amount of accumulated time in microseconds for which all tasks in a cgroup can run additionally for burst during one period (as defined by **`period`** below)
* **`burst`** *(uint64, OPTIONAL)* - specifies the maximum amount of burst time in microseconds for which all tasks in a cgroup can borrow from future periods during one period (as defined by **`period`** below)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This feature borrows time now against the future underrun ... is directly from the kernel doc and it's actually accumulating from the past rather than borrowing from future. It intends to say that borrowing time now to prepare for the future underestimation.

If specified, this value MUST be no larger than any positive `quota` (runtimes MAY generate an error).
* **`period`** *(uint64, OPTIONAL)* - specifies a period of time in microseconds for how regularly a cgroup's access to CPU resources should be reallocated (CFS scheduler only)
* **`realtimeRuntime`** *(int64, OPTIONAL)* - specifies a period of time in microseconds for the longest continuous period in which the tasks in a cgroup have access to CPU resources
* **`realtimePeriod`** *(uint64, OPTIONAL)* - same as **`period`** but applies to realtime scheduler only
Expand All @@ -373,6 +376,7 @@ The following parameters can be specified to set up the controller:
"cpu": {
"shares": 1024,
"quota": 1000000,
"burst": 1000000,
"period": 500000,
"realtimeRuntime": 950000,
"realtimePeriod": 1000000,
Expand Down
3 changes: 3 additions & 0 deletions schema/config-linux.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@
"quota": {
"$ref": "defs.json#/definitions/int64"
},
"burst": {
"$ref": "defs.json#/definitions/uint64"
},
"realtimePeriod": {
"$ref": "defs.json#/definitions/uint64"
},
Expand Down
1 change: 1 addition & 0 deletions schema/test/config/good/spec-example.json
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@
"cpu": {
"shares": 1024,
"quota": 1000000,
"burst": 1000000,
Copy link
Contributor

@marquiz marquiz Jan 20, 2023

Choose a reason for hiding this comment

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

Period MUST be no smaller than burst -> burst should not be greater than period(?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Period MUST be no smaller than burst

Why is this contraint needed? burst can be greater than period.

Copy link
Contributor

Choose a reason for hiding this comment

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

You're right. Sorry, my bad, I misread the new content on field description above 🙈

"period": 500000,
"realtimeRuntime": 950000,
"realtimePeriod": 1000000,
Expand Down
3 changes: 3 additions & 0 deletions specs-go/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,9 @@ type LinuxCPU struct {
Shares *uint64 `json:"shares,omitempty"`
// CPU hardcap limit (in usecs). Allowed cpu time in a given period.
Quota *int64 `json:"quota,omitempty"`
// CPU hardcap burst limit (in usecs). Allowed accumulated cpu time additionally for burst in a
// given period.
Burst *uint64 `json:"burst,omitempty"`
giuseppe marked this conversation as resolved.
Show resolved Hide resolved
// CPU period to be used for hardcapping (in usecs).
Period *uint64 `json:"period,omitempty"`
// How much time realtime scheduling may use (in usecs).
Expand Down