File tree 1 file changed +6
-6
lines changed 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 {
89
89
if r .CpuBurst != nil {
90
90
burst = strconv .FormatUint (* r .CpuBurst , 10 )
91
91
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 {
95
97
// Sometimes when the burst to be set is larger
96
98
// than the current one, it is rejected by the kernel
97
99
// (EINVAL) as old_quota/new_burst exceeds the parent
@@ -117,9 +119,7 @@ func (s *CpuGroup) Set(path string, r *configs.Resources) error {
117
119
}
118
120
if burst != "" {
119
121
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
123
123
}
124
124
}
125
125
}
You can’t perform that action at this time.
0 commit comments