Merge pull request #51066 from austinvazquez/deprecate-and-remove-kernel-memory-tcp

Deprecate and remove kernel memory tcp
This commit is contained in:
Sebastiaan van Stijn
2025-09-30 10:29:20 +02:00
committed by GitHub
14 changed files with 27 additions and 76 deletions

View File

@@ -40,6 +40,11 @@ keywords: "API, Docker, rcli, REST, documentation"
`GlobalIPv6Address`, `GlobalIPv6PrefixLen`, `IPAddress`, `IPPrefixLen`,
`IPv6Gateway`, and `MacAddress` fields. These fields were deprecated in
API v1.21 (docker v1.9.0) but kept around for backward compatibility.
* Removed the `KernelMemoryTCP` field from the `POST /containers/{id}/update` and
`GET /containers/{id}/json` endpoints, any value it is set to will be ignored
on API version `v1.52` and up. Older API versions still accept this field, but
may take no effect, depending on the kernel version and OCI runtime in use.
* Removed the `KernelMemoryTCP` field from the `GET /info` endpoint.
## v1.51 API changes
@@ -50,6 +55,11 @@ keywords: "API, Docker, rcli, REST, documentation"
This field was previously always -1.
* Deprecated: The field `NetworkSettings.Bridge` returned by `GET /containers/{id}/json`
is deprecated and will be removed in the next API version.
* Deprecated: The field `KernelMemoryTCP` as part of `POST /containers/{id}/update`
and returned by `GET /containers/{id}/json` is deprecated and will be removed
in the next API version.
* Deprecated: The field `KernelMemoryTCP` as part of `GET /info` is deprecated
and will be removed in the next API version.
## v1.50 API changes

View File

@@ -636,6 +636,9 @@ definitions:
by the default (runc) runtime.
This field is omitted when empty.
**Deprecated**: This field is deprecated as kernel 6.12 has deprecated `memory.kmem.tcp.limit_in_bytes` field
for cgroups v1. This field will be removed in a future release.
type: "integer"
format: "int64"
MemoryReservation:
@@ -6350,6 +6353,8 @@ definitions:
Kernel memory TCP limits are not supported when using cgroups v2, which
does not support the corresponding `memory.kmem.tcp.limit_in_bytes` cgroup.
**Deprecated**: This field is deprecated as kernel 6.12 has deprecated kernel memory TCP accounting.
type: "boolean"
example: true
CpuCfsPeriod:

View File

@@ -641,15 +641,6 @@ definitions:
type: "array"
items:
$ref: "#/definitions/DeviceRequest"
KernelMemoryTCP:
description: |
Hard limit for kernel TCP buffer memory (in bytes). Depending on the
OCI runtime in use, this option may be ignored. It is no longer supported
by the default (runc) runtime.
This field is omitted when empty.
type: "integer"
format: "int64"
MemoryReservation:
description: "Memory soft limit in bytes."
type: "integer"
@@ -6392,15 +6383,6 @@ definitions:
description: "Indicates if the host has memory swap limit support enabled."
type: "boolean"
example: true
KernelMemoryTCP:
description: |
Indicates if the host has kernel memory TCP limit support enabled. This
field is omitted if not supported.
Kernel memory TCP limits are not supported when using cgroups v2, which
does not support the corresponding `memory.kmem.tcp.limit_in_bytes` cgroup.
type: "boolean"
example: true
CpuCfsPeriod:
description: |
Indicates if CPU CFS(Completely Fair Scheduler) period is supported by

View File

@@ -641,15 +641,6 @@ definitions:
type: "array"
items:
$ref: "#/definitions/DeviceRequest"
KernelMemoryTCP:
description: |
Hard limit for kernel TCP buffer memory (in bytes). Depending on the
OCI runtime in use, this option may be ignored. It is no longer supported
by the default (runc) runtime.
This field is omitted when empty.
type: "integer"
format: "int64"
MemoryReservation:
description: "Memory soft limit in bytes."
type: "integer"
@@ -6392,15 +6383,6 @@ definitions:
description: "Indicates if the host has memory swap limit support enabled."
type: "boolean"
example: true
KernelMemoryTCP:
description: |
Indicates if the host has kernel memory TCP limit support enabled. This
field is omitted if not supported.
Kernel memory TCP limits are not supported when using cgroups v2, which
does not support the corresponding `memory.kmem.tcp.limit_in_bytes` cgroup.
type: "boolean"
example: true
CpuCfsPeriod:
description: |
Indicates if CPU CFS(Completely Fair Scheduler) period is supported by

View File

@@ -389,14 +389,12 @@ 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
KernelMemoryTCP int64 `json:",omitempty"` // 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
MemorySwappiness *int64 // Tuning container memory swappiness behaviour
OomKillDisable *bool // Whether to disable OOM Killer or not
PidsLimit *int64 // Setting PIDs limit for a container; Set `0` or `-1` for unlimited, or `null` to not change.
Ulimits []*Ulimit // List of ulimits to be set in the container
MemoryReservation int64 // Memory soft limit (in bytes)
MemorySwap int64 // Total memory usage (memory + swap); set `-1` to enable unlimited swap
MemorySwappiness *int64 // Tuning container memory swappiness behaviour
OomKillDisable *bool // Whether to disable OOM Killer or not
PidsLimit *int64 // Setting PIDs limit for a container; Set `0` or `-1` for unlimited, or `null` to not change.
Ulimits []*Ulimit // List of ulimits to be set in the container
// Applicable to Windows
CPUCount int64 `json:"CpuCount"` // CPU count

View File

@@ -21,7 +21,6 @@ type Info struct {
Plugins PluginsInfo
MemoryLimit bool
SwapLimit bool
KernelMemoryTCP bool `json:",omitempty"` // KernelMemoryTCP is not supported on cgroups v2.
CPUCfsPeriod bool `json:"CpuCfsPeriod"`
CPUCfsQuota bool `json:"CpuCfsQuota"`
CPUShares bool

View File

@@ -103,9 +103,6 @@ func getMemoryResources(config containertypes.Resources) *specs.LinuxMemory {
if config.OomKillDisable != nil {
memory.DisableOOMKiller = config.OomKillDisable
}
if config.KernelMemoryTCP != 0 {
memory.KernelTCP = &config.KernelMemoryTCP
}
if memory != (specs.LinuxMemory{}) {
return &memory

View File

@@ -34,7 +34,6 @@ func (daemon *Daemon) fillPlatformInfo(ctx context.Context, v *system.Info, sysI
if v.CgroupDriver != cgroupNoneDriver {
v.MemoryLimit = sysInfo.MemoryLimit
v.SwapLimit = sysInfo.SwapLimit
v.KernelMemoryTCP = sysInfo.KernelMemoryTCP
v.OomKillDisable = sysInfo.OomKillDisable
v.CPUCfsPeriod = sysInfo.CPUCfs
v.CPUCfsQuota = sysInfo.CPUCfs
@@ -93,11 +92,6 @@ func (daemon *Daemon) fillPlatformInfo(ctx context.Context, v *system.Info, sysI
if !v.SwapLimit {
v.Warnings = append(v.Warnings, "WARNING: No swap limit support")
}
if !v.KernelMemoryTCP && v.CgroupVersion == "1" {
// kernel memory is not available for cgroup v2.
// Warning is not printed on cgroup v2, because there is no action user can take.
v.Warnings = append(v.Warnings, "WARNING: No kernel memory TCP limit support")
}
if !v.OomKillDisable && v.CgroupVersion == "1" {
// oom kill disable is not available for cgroup v2.
// Warning is not printed on cgroup v2, because there is no action user can take.

View File

@@ -537,9 +537,6 @@ func (c *containerRouter) postContainersCreate(ctx context.Context, w http.Respo
}
}
// Ignore KernelMemoryTCP because it was added in API 1.40.
hostConfig.KernelMemoryTCP = 0
// Older clients (API < 1.40) expects the default to be shareable, make them happy
if hostConfig.IpcMode.IsEmpty() {
hostConfig.IpcMode = container.IPCModeShareable

View File

@@ -84,7 +84,6 @@ func applyMemoryCgroupInfoV2(info *SysInfo) {
info.MemoryReservation = true
info.OomKillDisable = false
info.MemorySwappiness = false
info.KernelMemoryTCP = false
}
func applyCPUCgroupInfoV2(info *SysInfo) {

View File

@@ -63,10 +63,6 @@ type cgroupMemInfo struct {
// Whether memory swappiness is supported or not
MemorySwappiness bool
// Whether kernel memory TCP limit is supported or not. Kernel memory TCP
// limit (`memory.kmem.tcp.limit_in_bytes`) is not supported on cgroups v2.
KernelMemoryTCP bool
}
type cgroupCPUInfo struct {

View File

@@ -152,11 +152,6 @@ func applyMemoryCgroupInfo(info *SysInfo) {
if !info.MemorySwappiness {
info.Warnings = append(info.Warnings, "Your kernel does not support memory swappiness")
}
// Option is deprecated in runc, but still accepted in our API, so setting
// the field to allow feature detection, but don't warn if it's missing, to
// make the daemon logs a bit less noisy.
info.KernelMemoryTCP = cgroupEnabled(mountPoint, "memory.kmem.tcp.limit_in_bytes")
}
// applyCPUCgroupInfo adds the cpu cgroup controller information to the info.

View File

@@ -389,14 +389,12 @@ 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
KernelMemoryTCP int64 `json:",omitempty"` // 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
MemorySwappiness *int64 // Tuning container memory swappiness behaviour
OomKillDisable *bool // Whether to disable OOM Killer or not
PidsLimit *int64 // Setting PIDs limit for a container; Set `0` or `-1` for unlimited, or `null` to not change.
Ulimits []*Ulimit // List of ulimits to be set in the container
MemoryReservation int64 // Memory soft limit (in bytes)
MemorySwap int64 // Total memory usage (memory + swap); set `-1` to enable unlimited swap
MemorySwappiness *int64 // Tuning container memory swappiness behaviour
OomKillDisable *bool // Whether to disable OOM Killer or not
PidsLimit *int64 // Setting PIDs limit for a container; Set `0` or `-1` for unlimited, or `null` to not change.
Ulimits []*Ulimit // List of ulimits to be set in the container
// Applicable to Windows
CPUCount int64 `json:"CpuCount"` // CPU count

View File

@@ -21,7 +21,6 @@ type Info struct {
Plugins PluginsInfo
MemoryLimit bool
SwapLimit bool
KernelMemoryTCP bool `json:",omitempty"` // KernelMemoryTCP is not supported on cgroups v2.
CPUCfsPeriod bool `json:"CpuCfsPeriod"`
CPUCfsQuota bool `json:"CpuCfsQuota"`
CPUShares bool