We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 5a529aa + ef935bd commit c09ecf1Copy full SHA for c09ecf1
pkg/kubelet/cm/helpers_linux.go
@@ -38,8 +38,11 @@ import (
38
)
39
40
const (
41
- // Taken from lmctfy https://github.com/google/lmctfy/blob/master/lmctfy/controllers/cpu_controller.cc
42
- MinShares = 2
+ // These limits are defined in the kernel:
+ // https://github.com/torvalds/linux/blob/0bddd227f3dc55975e2b8dfa7fc6f959b062a2c7/kernel/sched/sched.h#L427-L428
43
+ MinShares = 2
44
+ MaxShares = 262144
45
+
46
SharesPerCPU = 1024
47
MilliCPUToCPU = 1000
48
@@ -88,6 +91,9 @@ func MilliCPUToShares(milliCPU int64) uint64 {
88
91
if shares < MinShares {
89
92
return MinShares
90
93
}
94
+ if shares > MaxShares {
95
+ return MaxShares
96
+ }
97
return uint64(shares)
98
99
0 commit comments