Skip to content

Commit fb2f811

Browse files
austinvazquezthaJeztah
authored andcommitted
api: deprecate KernelMemoryTCP support
Starting with kernel v6.12, kernel memory TCP accounting is deprecated for cgroups v1. Note: kernel memory TCP accounting is not supported by cgroups v2. See torvalds/linux@d046ff4 Signed-off-by: Austin Vazquez <[email protected]> Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 9a97f59 commit fb2f811

12 files changed

Lines changed: 77 additions & 31 deletions

File tree

api/docs/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ keywords: "API, Docker, rcli, REST, documentation"
5050
This field was previously always -1.
5151
* Deprecated: The field `NetworkSettings.Bridge` returned by `GET /containers/{id}/json`
5252
is deprecated and will be removed in the next API version.
53+
* Deprecated: The field `KernelMemoryTCP` as part of `POST /containers/{id}/update`
54+
and returned by `GET /containers/{id}/json` is deprecated and will be removed
55+
in the next API version.
56+
* Deprecated: The field `KernelMemoryTCP` as part of `GET /info` is deprecated
57+
and will be removed in the next API version.
5358

5459
## v1.50 API changes
5560

api/docs/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:

api/docs/v1.52.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,9 @@ definitions:
648648
by the default (runc) runtime.
649649
650650
This field is omitted when empty.
651+
652+
**Deprecated**: This field is deprecated as kernel 6.12 has deprecated `memory.kmem.tcp.limit_in_bytes` field
653+
for cgroups v1. This field will be removed in a future release.
651654
type: "integer"
652655
format: "int64"
653656
MemoryReservation:
@@ -6399,6 +6402,8 @@ definitions:
63996402
64006403
Kernel memory TCP limits are not supported when using cgroups v2, which
64016404
does not support the corresponding `memory.kmem.tcp.limit_in_bytes` cgroup.
6405+
6406+
**Deprecated**: This field is deprecated as kernel 6.12 has deprecated kernel memory TCP accounting.
64026407
type: "boolean"
64036408
example: true
64046409
CpuCfsPeriod:

api/swagger.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,9 @@ definitions:
648648
by the default (runc) runtime.
649649
650650
This field is omitted when empty.
651+
652+
**Deprecated**: This field is deprecated as kernel 6.12 has deprecated `memory.kmem.tcp.limit_in_bytes` field
653+
for cgroups v1. This field will be removed in a future release.
651654
type: "integer"
652655
format: "int64"
653656
MemoryReservation:
@@ -6399,6 +6402,8 @@ definitions:
63996402
64006403
Kernel memory TCP limits are not supported when using cgroups v2, which
64016404
does not support the corresponding `memory.kmem.tcp.limit_in_bytes` cgroup.
6405+
6406+
**Deprecated**: This field is deprecated as kernel 6.12 has deprecated kernel memory TCP accounting.
64026407
type: "boolean"
64036408
example: true
64046409
CpuCfsPeriod:

api/types/container/hostconfig.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,11 @@ type Resources struct {
390390
DeviceCgroupRules []string // List of rule to be added to the device cgroup
391391
DeviceRequests []DeviceRequest // List of device requests for device drivers
392392

393+
// Hard limit for kernel TCP buffer memory (in bytes).
394+
//
395+
// Deprecated: This field is deprecated and will be removed in the next release.
396+
// Starting with 6.12, the kernel has deprecated kernel memory tcp accounting
397+
// for cgroups v1.
393398
KernelMemoryTCP int64 `json:",omitempty"` // Hard limit for kernel TCP buffer memory (in bytes)
394399
MemoryReservation int64 // Memory soft limit (in bytes)
395400
MemorySwap int64 // Total memory usage (memory + swap); set `-1` to enable unlimited swap

api/types/system/info.go

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,25 @@ 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-
KernelMemoryTCP bool `json:",omitempty"` // KernelMemoryTCP is not supported on cgroups v2.
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+
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
29+
KernelMemoryTCP bool `json:",omitempty"`
30+
2531
CPUCfsPeriod bool `json:"CpuCfsPeriod"`
2632
CPUCfsQuota bool `json:"CpuCfsQuota"`
2733
CPUShares bool

daemon/daemon_unix.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ func getMemoryResources(config containertypes.Resources) *specs.LinuxMemory {
103103
if config.OomKillDisable != nil {
104104
memory.DisableOOMKiller = config.OomKillDisable
105105
}
106-
if config.KernelMemoryTCP != 0 {
107-
memory.KernelTCP = &config.KernelMemoryTCP
106+
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.
107+
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.
108108
}
109109

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

daemon/info_unix.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func (daemon *Daemon) fillPlatformInfo(ctx context.Context, v *system.Info, sysI
3434
if v.CgroupDriver != cgroupNoneDriver {
3535
v.MemoryLimit = sysInfo.MemoryLimit
3636
v.SwapLimit = sysInfo.SwapLimit
37-
v.KernelMemoryTCP = sysInfo.KernelMemoryTCP
37+
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.
3838
v.OomKillDisable = sysInfo.OomKillDisable
3939
v.CPUCfsPeriod = sysInfo.CPUCfs
4040
v.CPUCfsQuota = sysInfo.CPUCfs
@@ -93,7 +93,7 @@ func (daemon *Daemon) fillPlatformInfo(ctx context.Context, v *system.Info, sysI
9393
if !v.SwapLimit {
9494
v.Warnings = append(v.Warnings, "WARNING: No swap limit support")
9595
}
96-
if !v.KernelMemoryTCP && v.CgroupVersion == "1" {
96+
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.
9797
// kernel memory is not available for cgroup v2.
9898
// Warning is not printed on cgroup v2, because there is no action user can take.
9999
v.Warnings = append(v.Warnings, "WARNING: No kernel memory TCP limit support")

daemon/server/router/container/container_routes.go

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

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

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

pkg/sysinfo/sysinfo.go

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

6767
// Whether kernel memory TCP limit is supported or not. Kernel memory TCP
6868
// limit (`memory.kmem.tcp.limit_in_bytes`) is not supported on cgroups v2.
69+
//
70+
// Deprecated: This field is deprecated and will be removed in the next release.
71+
// Starting with 6.12, the kernel has deprecated kernel memory tcp accounting
72+
// for cgroups v1.
6973
KernelMemoryTCP bool
7074
}
7175

0 commit comments

Comments
 (0)