mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #41254 from AkihiroSuda/deprecate-kernel-memory
Deprecate KernelMemory
This commit is contained in:
commit
846b7e24ba
6 changed files with 24 additions and 7 deletions
|
@ -528,7 +528,13 @@ definitions:
|
||||||
items:
|
items:
|
||||||
$ref: "#/definitions/DeviceRequest"
|
$ref: "#/definitions/DeviceRequest"
|
||||||
KernelMemory:
|
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"
|
type: "integer"
|
||||||
format: "int64"
|
format: "int64"
|
||||||
example: 209715200
|
example: 209715200
|
||||||
|
@ -4430,7 +4436,13 @@ definitions:
|
||||||
type: "boolean"
|
type: "boolean"
|
||||||
example: true
|
example: true
|
||||||
KernelMemory:
|
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"
|
type: "boolean"
|
||||||
example: true
|
example: true
|
||||||
CpuCfsPeriod:
|
CpuCfsPeriod:
|
||||||
|
|
|
@ -361,7 +361,7 @@ type Resources struct {
|
||||||
Devices []DeviceMapping // List of devices to map inside the container
|
Devices []DeviceMapping // List of devices to map inside the container
|
||||||
DeviceCgroupRules []string // List of rule to be added to the device cgroup
|
DeviceCgroupRules []string // List of rule to be added to the device cgroup
|
||||||
DeviceRequests []DeviceRequest // List of device requests for device drivers
|
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)
|
KernelMemoryTCP int64 // Hard limit for kernel TCP buffer memory (in bytes)
|
||||||
MemoryReservation int64 // Memory soft limit (in bytes)
|
MemoryReservation int64 // Memory soft limit (in bytes)
|
||||||
MemorySwap int64 // Total memory usage (memory + swap); set `-1` to enable unlimited swap
|
MemorySwap int64 // Total memory usage (memory + swap); set `-1` to enable unlimited swap
|
||||||
|
|
|
@ -158,7 +158,7 @@ type Info struct {
|
||||||
Plugins PluginsInfo
|
Plugins PluginsInfo
|
||||||
MemoryLimit bool
|
MemoryLimit bool
|
||||||
SwapLimit bool
|
SwapLimit bool
|
||||||
KernelMemory bool
|
KernelMemory bool // Deprecated: kernel 5.4 deprecated kmem.limit_in_bytes
|
||||||
KernelMemoryTCP bool
|
KernelMemoryTCP bool
|
||||||
CPUCfsPeriod bool `json:"CpuCfsPeriod"`
|
CPUCfsPeriod bool `json:"CpuCfsPeriod"`
|
||||||
CPUCfsQuota bool `json:"CpuCfsQuota"`
|
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 {
|
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")
|
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 {
|
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.")
|
warnings = append(warnings, "Your kernel does not support kernel memory limit capabilities or the cgroup is not mounted. Limitation discarded.")
|
||||||
resources.KernelMemory = 0
|
resources.KernelMemory = 0
|
||||||
|
|
|
@ -100,9 +100,6 @@ func (daemon *Daemon) fillPlatformInfo(v *types.Info, sysInfo *sysinfo.SysInfo)
|
||||||
if !v.SwapLimit {
|
if !v.SwapLimit {
|
||||||
v.Warnings = append(v.Warnings, "WARNING: No swap limit support")
|
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 {
|
if !v.KernelMemoryTCP {
|
||||||
v.Warnings = append(v.Warnings, "WARNING: No kernel memory TCP limit support")
|
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.
|
job-mode service.
|
||||||
* `GET /containers/{id}/stats` now accepts a query param (`one-shot`) which, when used with `stream=false` fetches a
|
* `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.
|
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
|
## v1.40 API changes
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue