Commit d415765 1 parent d0d0c4c commit d415765 Copy full SHA for d415765
File tree 1 file changed +8
-1
lines changed
1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,10 @@ import (
46
46
* Consts
47
47
**********************************************************************************************************************/
48
48
49
- const defaultCPUPeriod uint64 = 100000
49
+ const (
50
+ defaultCPUPeriod uint64 = 100000
51
+ minCPUQuota int64 = 1000
52
+ )
50
53
51
54
const cgroupsPath = "/system.slice/system-aos\\ x2dservice.slice/"
52
55
@@ -116,7 +119,11 @@ func (spec *runtimeSpec) setCPULimit(cpuLimit uint64) {
116
119
}
117
120
118
121
cpuPeriod := defaultCPUPeriod
122
+
119
123
cpuQuota := int64 (cpuLimit * defaultCPUPeriod * uint64 (runtime .NumCPU ()) / spec .nodeInfo .MaxDMIPs )
124
+ if cpuQuota < minCPUQuota {
125
+ cpuQuota = minCPUQuota
126
+ }
120
127
121
128
spec .ociSpec .Linux .Resources .CPU .Period = & cpuPeriod
122
129
spec .ociSpec .Linux .Resources .CPU .Quota = & cpuQuota
You can’t perform that action at this time.
0 commit comments