mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Merge pull request #93248 from giuseppe/cgroup-set-max-shares
kubelet: clamp cpu.shares to max allowed
This commit is contained in:
commit
c09ecf13a5
@ -38,8 +38,11 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
// Taken from lmctfy https://github.com/google/lmctfy/blob/master/lmctfy/controllers/cpu_controller.cc
|
||||
MinShares = 2
|
||||
// These limits are defined in the kernel:
|
||||
// https://github.com/torvalds/linux/blob/0bddd227f3dc55975e2b8dfa7fc6f959b062a2c7/kernel/sched/sched.h#L427-L428
|
||||
MinShares = 2
|
||||
MaxShares = 262144
|
||||
|
||||
SharesPerCPU = 1024
|
||||
MilliCPUToCPU = 1000
|
||||
|
||||
@ -88,6 +91,9 @@ func MilliCPUToShares(milliCPU int64) uint64 {
|
||||
if shares < MinShares {
|
||||
return MinShares
|
||||
}
|
||||
if shares > MaxShares {
|
||||
return MaxShares
|
||||
}
|
||||
return uint64(shares)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user