Skip to content

Commit 8d2c7a9

Browse files
committed
linux: clarify pids cgroup settings
While the original wording did not provide any justification for this, some runtimes have incorrectly treated a pids.limit value of 0 as being equivalent to "max" or otherwise handle it suboptimally. So, add some clarifying wording that the correct representation of max is -1 (like every other cgroup configuration) and that users should not treat 0 as a special value of any kind. Note that a pids.limit value of 0 is actually different to 1 now that CLONE_INTO_CGROUP exists (at the time pids was added to the kernel and the spec, this feature didn't exist and so it may have seemed redundant to have two equivalent values). Signed-off-by: Aleksa Sarai <[email protected]>
1 parent 2f2d37e commit 8d2c7a9

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

config-linux.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,9 @@ For more information, see the kernel cgroups documentation about [pids][cgroup-v
564564

565565
The following parameters can be specified to set up the controller:
566566

567-
* **`limit`** *(int64, REQUIRED)* - specifies the maximum number of tasks in the cgroup
567+
* **`limit`** *(int64, REQUIRED)* - specifies the maximum number of tasks in the cgroup, with `-1` indicating no limit (`max`).
568+
569+
> Note: Even though it superficially seems redundant, `0` is a valid limit value for the `pids` cgroup controller and SHOULD NOT be treated as a special value.
568570
569571
#### Example
570572

specs-go/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ type LinuxCPU struct {
430430
// LinuxPids for Linux cgroup 'pids' resource management (Linux 4.3)
431431
type LinuxPids struct {
432432
// Maximum number of PIDs. Default is "no limit".
433-
Limit int64 `json:"limit"`
433+
Limit *int64 `json:"limit,omitempty"`
434434
}
435435

436436
// LinuxNetwork identification and priority configuration

0 commit comments

Comments
 (0)