File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -89,9 +89,11 @@ func (s *CpuGroup) Set(path string, r *configs.Resources) error {
8989 if r .CpuBurst != nil {
9090 burst = strconv .FormatUint (* r .CpuBurst , 10 )
9191 if err := cgroups .WriteFile (path , "cpu.cfs_burst_us" , burst ); err != nil {
92- // this is a special trick for burst feature, the current systemd and low version of kernel will not support it.
93- // So, an `no such file or directory` error would be raised, and we can ignore it .
94- if ! errors .Is (err , unix .ENOENT ) {
92+ if errors .Is (err , unix .ENOENT ) {
93+ // If CPU burst knob is not available (e.g.
94+ // older kernel), ignore it.
95+ burst = ""
96+ } else {
9597 // Sometimes when the burst to be set is larger
9698 // than the current one, it is rejected by the kernel
9799 // (EINVAL) as old_quota/new_burst exceeds the parent
@@ -117,9 +119,7 @@ func (s *CpuGroup) Set(path string, r *configs.Resources) error {
117119 }
118120 if burst != "" {
119121 if err := cgroups .WriteFile (path , "cpu.cfs_burst_us" , burst ); err != nil {
120- if ! errors .Is (err , unix .ENOENT ) {
121- return err
122- }
122+ return err
123123 }
124124 }
125125 }
You can’t perform that action at this time.
0 commit comments