mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Deprecate KernelMemory
Kernel memory limit is not supported on cgroup v2.
Even on cgroup v1, kernel memory limit (`kmem.limit_in_bytes`) has been deprecated since kernel 5.4.
0158115f70
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
This commit is contained in:
parent
a770dc191e
commit
b8ca7de823
6 changed files with 24 additions and 7 deletions
|
@ -528,7 +528,13 @@ definitions:
|
|||
items:
|
||||
$ref: "#/definitions/DeviceRequest"
|
||||
KernelMemory:
|
||||
description: "Kernel memory limit in bytes."
|
||||
description: |
|
||||
Kernel memory limit in bytes.
|
||||
|
||||
<p><br /></p>
|
||||
|
||||
> **Deprecated**: This field is deprecated as the kernel 5.4 deprecated
|
||||
> `kmem.limit_in_bytes`.
|
||||
type: "integer"
|
||||
format: "int64"
|
||||
example: 209715200
|
||||
|
@ -4321,7 +4327,13 @@ definitions:
|
|||
type: "boolean"
|
||||
example: true
|
||||
KernelMemory:
|
||||
description: "Indicates if the host has kernel memory limit support enabled."
|
||||
description: |
|
||||
Indicates if the host has kernel memory limit support enabled.
|
||||
|
||||
<p><br /></p>
|
||||
|
||||
> **Deprecated**: This field is deprecated as the kernel 5.4 deprecated
|
||||
> `kmem.limit_in_bytes`.
|
||||
type: "boolean"
|
||||
example: true
|
||||
CpuCfsPeriod:
|
||||
|
|
|
@ -361,7 +361,7 @@ type Resources struct {
|
|||
Devices []DeviceMapping // List of devices to map inside the container
|
||||
DeviceCgroupRules []string // List of rule to be added to the device cgroup
|
||||
DeviceRequests []DeviceRequest // List of device requests for device drivers
|
||||
KernelMemory int64 // Kernel memory limit (in bytes)
|
||||
KernelMemory int64 // Kernel memory limit (in bytes), Deprecated: kernel 5.4 deprecated kmem.limit_in_bytes
|
||||
KernelMemoryTCP int64 // Hard limit for kernel TCP buffer memory (in bytes)
|
||||
MemoryReservation int64 // Memory soft limit (in bytes)
|
||||
MemorySwap int64 // Total memory usage (memory + swap); set `-1` to enable unlimited swap
|
||||
|
|
|
@ -158,7 +158,7 @@ type Info struct {
|
|||
Plugins PluginsInfo
|
||||
MemoryLimit bool
|
||||
SwapLimit bool
|
||||
KernelMemory bool
|
||||
KernelMemory bool // Deprecated: kernel 5.4 deprecated kmem.limit_in_bytes
|
||||
KernelMemoryTCP bool
|
||||
CPUCfsPeriod bool `json:"CpuCfsPeriod"`
|
||||
CPUCfsQuota bool `json:"CpuCfsQuota"`
|
||||
|
|
|
@ -465,6 +465,12 @@ func verifyPlatformContainerResources(resources *containertypes.Resources, sysIn
|
|||
if resources.Memory > 0 && resources.MemoryReservation > 0 && resources.Memory < resources.MemoryReservation {
|
||||
return warnings, fmt.Errorf("Minimum memory limit can not be less than memory reservation limit, see usage")
|
||||
}
|
||||
if resources.KernelMemory > 0 {
|
||||
// Kernel memory limit is not supported on cgroup v2.
|
||||
// Even on cgroup v1, kernel memory limit (`kmem.limit_in_bytes`) has been deprecated since kernel 5.4.
|
||||
// https://github.com/torvalds/linux/commit/0158115f702b0ba208ab0b5adf44cae99b3ebcc7
|
||||
warnings = append(warnings, "Specifying a kernel memory limit is deprecated and will be removed in a future release.")
|
||||
}
|
||||
if resources.KernelMemory > 0 && !sysInfo.KernelMemory {
|
||||
warnings = append(warnings, "Your kernel does not support kernel memory limit capabilities or the cgroup is not mounted. Limitation discarded.")
|
||||
resources.KernelMemory = 0
|
||||
|
|
|
@ -100,9 +100,6 @@ func (daemon *Daemon) fillPlatformInfo(v *types.Info, sysInfo *sysinfo.SysInfo)
|
|||
if !v.SwapLimit {
|
||||
v.Warnings = append(v.Warnings, "WARNING: No swap limit support")
|
||||
}
|
||||
if !v.KernelMemory {
|
||||
v.Warnings = append(v.Warnings, "WARNING: No kernel memory limit support")
|
||||
}
|
||||
if !v.KernelMemoryTCP {
|
||||
v.Warnings = append(v.Warnings, "WARNING: No kernel memory TCP limit support")
|
||||
}
|
||||
|
|
|
@ -74,6 +74,8 @@ keywords: "API, Docker, rcli, REST, documentation"
|
|||
job-mode service.
|
||||
* `GET /containers/{id}/stats` now accepts a query param (`one-shot`) which, when used with `stream=false` fetches a
|
||||
single set of stats instead of waiting for two collection cycles to have 2 CPU stats over a 1 second period.
|
||||
* The `KernelMemory` field in `HostConfig.Resources` is now deprecated.
|
||||
* The `KernelMemory` field in `Info` is now deprecated.
|
||||
|
||||
## v1.40 API changes
|
||||
|
||||
|
|
Loading…
Reference in a new issue