summaryrefslogtreecommitdiffhomepage
path: root/runsc/sandbox/sandbox.go
diff options
context:
space:
mode:
authorAleksandr Razumov <a.razumov@corp.mail.ru>2019-12-17 20:41:02 +0300
committerAleksandr Razumov <a.razumov@corp.mail.ru>2019-12-17 20:41:02 +0300
commit67f678be27b3f4545d41539bd6855527da53a250 (patch)
tree66d35d45dce0f360c289db9a9943ae5297d1becf /runsc/sandbox/sandbox.go
parentb661434202672f920291bf5685b68772103c66cb (diff)
Leave minimum CPU number as a constant
Remove introduced CPUNumMin config and hard-code it as 2.
Diffstat (limited to 'runsc/sandbox/sandbox.go')
-rw-r--r--runsc/sandbox/sandbox.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/runsc/sandbox/sandbox.go b/runsc/sandbox/sandbox.go
index f6feadf75..ce1452b87 100644
--- a/runsc/sandbox/sandbox.go
+++ b/runsc/sandbox/sandbox.go
@@ -633,13 +633,18 @@ func (s *Sandbox) createSandboxProcess(conf *boot.Config, args *Args, startSyncF
return fmt.Errorf("getting cpu count from cgroups: %v", err)
}
if conf.CPUNumFromQuota {
+ // Dropping below 2 CPUs can trigger application to disable
+ // locks that can lead do hard to debug errors, so just
+ // leaving two cores as reasonable default.
+ const minCPUs = 2
+
quota, err := s.Cgroup.CPUQuota()
if err != nil {
return fmt.Errorf("getting cpu qouta from cgroups: %v", err)
}
if n := int(math.Ceil(quota)); n > 0 {
- if n < conf.CPUNumMin {
- n = conf.CPUNumMin
+ if n < minCPUs {
+ n = minCPUs
}
if n < cpuNum {
// Only lower the cpu number.