@@ -24,7 +24,6 @@ import (
24
24
"path/filepath"
25
25
"strconv"
26
26
"strings"
27
- "syscall"
28
27
29
28
v1 "github.com/containerd/cgroups/stats/v1"
30
29
specs "github.com/opencontainers/runtime-spec/specs-go"
@@ -207,21 +206,6 @@ func (m *memoryController) Create(path string, resources *specs.LinuxResources)
207
206
if resources .Memory == nil {
208
207
return nil
209
208
}
210
- if resources .Memory .Kernel != nil {
211
- // Check if kernel memory is enabled
212
- // We have to limit the kernel memory here as it won't be accounted at all
213
- // until a limit is set on the cgroup and limit cannot be set once the
214
- // cgroup has children, or if there are already tasks in the cgroup.
215
- for _ , i := range []int64 {1 , - 1 } {
216
- if err := retryingWriteFile (
217
- filepath .Join (m .Path (path ), "memory.kmem.limit_in_bytes" ),
218
- []byte (strconv .FormatInt (i , 10 )),
219
- defaultFilePerm ,
220
- ); err != nil {
221
- return checkEBUSY (err )
222
- }
223
- }
224
- }
225
209
return m .set (path , getMemorySettings (resources ))
226
210
}
227
211
@@ -466,18 +450,6 @@ func getMemorySettings(resources *specs.LinuxResources) []memorySettings {
466
450
}
467
451
}
468
452
469
- func checkEBUSY (err error ) error {
470
- if pathErr , ok := err .(* os.PathError ); ok {
471
- if errNo , ok := pathErr .Err .(syscall.Errno ); ok {
472
- if errNo == unix .EBUSY {
473
- return fmt .Errorf (
474
- "failed to set memory.kmem.limit_in_bytes, because either tasks have already joined this cgroup or it has children" )
475
- }
476
- }
477
- }
478
- return err
479
- }
480
-
481
453
func getOomControlValue (mem * specs.LinuxMemory ) * int64 {
482
454
if mem .DisableOOMKiller != nil && * mem .DisableOOMKiller {
483
455
i := int64 (1 )
0 commit comments