Skip to content

Commit 79f310d

Browse files
authored
Merge pull request #51067 from austinvazquez/cherry-pick-deprecate-kernel-memocy-tcp-to-28.x
[28.x backport] api: deprecate `KernelMemoryTCP` support
2 parents 423a7fd + deb4bbb commit 79f310d

10 files changed

Lines changed: 52 additions & 19 deletions

File tree

api/server/router/container/container_routes.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ func (c *containerRouter) postContainersCreate(ctx context.Context, w http.Respo
531531
}
532532

533533
// Ignore KernelMemoryTCP because it was added in API 1.40.
534-
hostConfig.KernelMemoryTCP = 0
534+
hostConfig.KernelMemoryTCP = 0 //nolint:staticcheck // ignore SA1019 This field is still used for legacy support.
535535

536536
// Older clients (API < 1.40) expects the default to be shareable, make them happy
537537
if hostConfig.IpcMode.IsEmpty() {

api/swagger.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,9 @@ definitions:
636636
by the default (runc) runtime.
637637
638638
This field is omitted when empty.
639+
640+
**Deprecated**: This field is deprecated as kernel 6.12 has deprecated `memory.kmem.tcp.limit_in_bytes` field
641+
for cgroups v1. This field will be removed in a future release.
639642
type: "integer"
640643
format: "int64"
641644
MemoryReservation:
@@ -6350,6 +6353,8 @@ definitions:
63506353
63516354
Kernel memory TCP limits are not supported when using cgroups v2, which
63526355
does not support the corresponding `memory.kmem.tcp.limit_in_bytes` cgroup.
6356+
6357+
**Deprecated**: This field is deprecated as kernel 6.12 has deprecated kernel memory TCP accounting.
63536358
type: "boolean"
63546359
example: true
63556360
CpuCfsPeriod:

api/types/container/hostconfig.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,12 @@ type Resources struct {
394394

395395
// KernelMemory specifies the kernel memory limit (in bytes) for the container.
396396
// Deprecated: kernel 5.4 deprecated kmem.limit_in_bytes.
397-
KernelMemory int64 `json:",omitempty"`
397+
KernelMemory int64 `json:",omitempty"`
398+
// Hard limit for kernel TCP buffer memory (in bytes).
399+
//
400+
// Deprecated: This field is deprecated and will be removed in the next release.
401+
// Starting with 6.12, the kernel has deprecated kernel memory tcp accounting
402+
// for cgroups v1.
398403
KernelMemoryTCP int64 `json:",omitempty"` // Hard limit for kernel TCP buffer memory (in bytes)
399404
MemoryReservation int64 // Memory soft limit (in bytes)
400405
MemorySwap int64 // Total memory usage (memory + swap); set `-1` to enable unlimited swap

api/types/system/info.go

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,23 @@ import (
99
// Info contains response of Engine API:
1010
// GET "/info"
1111
type Info struct {
12-
ID string
13-
Containers int
14-
ContainersRunning int
15-
ContainersPaused int
16-
ContainersStopped int
17-
Images int
18-
Driver string
19-
DriverStatus [][2]string
20-
SystemStatus [][2]string `json:",omitempty"` // SystemStatus is only propagated by the Swarm standalone API
21-
Plugins PluginsInfo
22-
MemoryLimit bool
23-
SwapLimit bool
24-
KernelMemory bool `json:",omitempty"` // Deprecated: kernel 5.4 deprecated kmem.limit_in_bytes
12+
ID string
13+
Containers int
14+
ContainersRunning int
15+
ContainersPaused int
16+
ContainersStopped int
17+
Images int
18+
Driver string
19+
DriverStatus [][2]string
20+
SystemStatus [][2]string `json:",omitempty"` // SystemStatus is only propagated by the Swarm standalone API
21+
Plugins PluginsInfo
22+
MemoryLimit bool
23+
SwapLimit bool
24+
KernelMemory bool `json:",omitempty"` // Deprecated: kernel 5.4 deprecated kmem.limit_in_bytes
25+
// KernelMemoryLimit is not supported on cgroups v2.
26+
//
27+
// Deprecated: This field is deprecated and will be removed in the next release.
28+
// Starting with kernel 6.12, the kernel has deprecated kernel memory tcp accounting
2529
KernelMemoryTCP bool `json:",omitempty"` // KernelMemoryTCP is not supported on cgroups v2.
2630
CPUCfsPeriod bool `json:"CpuCfsPeriod"`
2731
CPUCfsQuota bool `json:"CpuCfsQuota"`

daemon/daemon_unix.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ func getMemoryResources(config containertypes.Resources) *specs.LinuxMemory {
112112
memory.Kernel = &config.KernelMemory //nolint:staticcheck // ignore SA1019: memory.Kernel is deprecated: kernel-memory limits are not supported in cgroups v2, and were obsoleted in [kernel v5.4]. This field should no longer be used, as it may be ignored by runtimes.
113113
}
114114

115-
if config.KernelMemoryTCP != 0 {
116-
memory.KernelTCP = &config.KernelMemoryTCP
115+
if config.KernelMemoryTCP != 0 { //nolint:staticcheck // ignore SA1019: memory.KernelTCP is deprecated: kernel memory tcp accounting is not supported in cgroups v2, and has been deprecated in [kernel v6.12]. This field should no longer be used, as it may be ignored by runtimes.
116+
memory.KernelTCP = &config.KernelMemoryTCP //nolint:staticcheck // ignore SA1019: memory.KernelTCP is deprecated: kernel memory tcp accounting is not supported in cgroups v2, and has been deprecated in [kernel v6.12]. This field should no longer be used, as it may be ignored by runtimes.
117117
}
118118

119119
if memory != (specs.LinuxMemory{}) {

daemon/info_unix.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func (daemon *Daemon) fillPlatformInfo(ctx context.Context, v *system.Info, sysI
3535
v.MemoryLimit = sysInfo.MemoryLimit
3636
v.SwapLimit = sysInfo.SwapLimit
3737
v.KernelMemory = sysInfo.KernelMemory
38-
v.KernelMemoryTCP = sysInfo.KernelMemoryTCP
38+
v.KernelMemoryTCP = sysInfo.KernelMemoryTCP //nolint:staticcheck // ignore SA1019: memory.KernelTCP is deprecated: kernel memory tcp accounting is not supported in cgroups v2, and has been deprecated in [kernel v6.12]. This field should no longer be used, as it may be ignored by runtimes.
3939
v.OomKillDisable = sysInfo.OomKillDisable
4040
v.CPUCfsPeriod = sysInfo.CPUCfs
4141
v.CPUCfsQuota = sysInfo.CPUCfs
@@ -94,7 +94,7 @@ func (daemon *Daemon) fillPlatformInfo(ctx context.Context, v *system.Info, sysI
9494
if !v.SwapLimit {
9595
v.Warnings = append(v.Warnings, "WARNING: No swap limit support")
9696
}
97-
if !v.KernelMemoryTCP && v.CgroupVersion == "1" {
97+
if !v.KernelMemoryTCP && v.CgroupVersion == "1" { //nolint:staticcheck // ignore SA1019: memory.KernelTCP is deprecated: kernel memory tcp accounting is not supported in cgroups v2, and has been deprecated in [kernel v6.12]. This field should no longer be used, as it may be ignored by runtimes.
9898
// kernel memory is not available for cgroup v2.
9999
// Warning is not printed on cgroup v2, because there is no action user can take.
100100
v.Warnings = append(v.Warnings, "WARNING: No kernel memory TCP limit support")

docs/api/v1.50.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,9 @@ definitions:
636636
by the default (runc) runtime.
637637
638638
This field is omitted when empty.
639+
640+
**Deprecated**: This field is deprecated as kernel 6.12 has deprecated `memory.kmem.tcp.limit_in_bytes` field
641+
for cgroups v1. This field will be removed in a future release.
639642
type: "integer"
640643
format: "int64"
641644
MemoryReservation:
@@ -6351,6 +6354,8 @@ definitions:
63516354
63526355
Kernel memory TCP limits are not supported when using cgroups v2, which
63536356
does not support the corresponding `memory.kmem.tcp.limit_in_bytes` cgroup.
6357+
6358+
**Deprecated**: This field is deprecated as kernel 6.12 has deprecated kernel memory TCP accounting.
63546359
type: "boolean"
63556360
example: true
63566361
CpuCfsPeriod:

docs/api/v1.51.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,9 @@ definitions:
636636
by the default (runc) runtime.
637637
638638
This field is omitted when empty.
639+
640+
**Deprecated**: This field is deprecated as kernel 6.12 has deprecated `memory.kmem.tcp.limit_in_bytes` field
641+
for cgroups v1. This field will be removed in a future release.
639642
type: "integer"
640643
format: "int64"
641644
MemoryReservation:
@@ -6350,6 +6353,8 @@ definitions:
63506353
63516354
Kernel memory TCP limits are not supported when using cgroups v2, which
63526355
does not support the corresponding `memory.kmem.tcp.limit_in_bytes` cgroup.
6356+
6357+
**Deprecated**: This field is deprecated as kernel 6.12 has deprecated kernel memory TCP accounting.
63536358
type: "boolean"
63546359
example: true
63556360
CpuCfsPeriod:

docs/api/version-history.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ keywords: "API, Docker, rcli, REST, documentation"
2222
This field was previously always -1.
2323
* Deprecated: The field `NetworkSettings.Bridge` returned by `GET /containers/{id}/json`
2424
is deprecated and will be removed in the next API version.
25+
* Deprecated: The field `KernelMemoryTCP` as part of `POST /containers/{id}/update`
26+
and returned by `GET /containers/{id}/json` is deprecated and will be removed
27+
in the next API version.
28+
* Deprecated: The field `KernelMemoryTCP` as part of `GET /info` is deprecated
29+
and will be removed in the next API version.
2530

2631
## v1.50 API changes
2732

pkg/sysinfo/sysinfo.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ type cgroupMemInfo struct {
7272

7373
// Whether kernel memory TCP limit is supported or not. Kernel memory TCP
7474
// limit (`memory.kmem.tcp.limit_in_bytes`) is not supported on cgroups v2.
75+
//
76+
// Deprecated: This field is deprecated and will be removed in the next release.
77+
// Starting with 6.12, the kernel has deprecated kernel memory tcp accounting
78+
// for cgroups v1.
7579
KernelMemoryTCP bool
7680
}
7781

0 commit comments

Comments
 (0)