summaryrefslogtreecommitdiffhomepage
path: root/runsc/boot/config.go
diff options
context:
space:
mode:
authorAleksandr Razumov <a.razumov@corp.mail.ru>2019-12-17 13:06:42 +0300
committerAleksandr Razumov <a.razumov@corp.mail.ru>2019-12-17 13:27:13 +0300
commitb661434202672f920291bf5685b68772103c66cb (patch)
treeb242497f07ca106a2600910a5cd8b8ff865b23ca /runsc/boot/config.go
parent8782f0e287df2a2fd9f9dfb3f0e1589cc15a4f91 (diff)
Add minimum CPU number and only lower CPUs on --cpu-num-from-quota
* Add `--cpu-num-min` flag to control minimum CPUs * Only lower CPU count * Fix comments
Diffstat (limited to 'runsc/boot/config.go')
-rw-r--r--runsc/boot/config.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/runsc/boot/config.go b/runsc/boot/config.go
index 7841d1a7a..d9f5b67c0 100644
--- a/runsc/boot/config.go
+++ b/runsc/boot/config.go
@@ -254,8 +254,14 @@ type Config struct {
// CPUNumFromQuota sets CPU number count to available CPU quota, using
// least integer value greater than or equal to quota.
//
- // E.g. 0.2 CPU quota would result in 1, and 1.9 in 2.
+ // E.g. 0.2 CPU quota will result in 1, and 1.9 in 2.
CPUNumFromQuota bool
+
+ // CPUNumMin is minimum value of CPU number setting when CPUNumFromQuota
+ // strategy is active.
+ //
+ // E.g. when CPUNumMin is 2, 0.2 CPU quota will result in 2 instead of 1.
+ CPUNumMin int
}
// ToFlags returns a slice of flags that correspond to the given Config.
@@ -289,7 +295,9 @@ func (c *Config) ToFlags() []string {
"--overlayfs-stale-read=" + strconv.FormatBool(c.OverlayfsStaleRead),
}
if c.CPUNumFromQuota {
- f = append(f, "--cpu-num-from-quota")
+ f = append(f, "--cpu-num-from-quota",
+ "--cpu-num-min="+strconv.Itoa(c.CPUNumMin),
+ )
}
// Only include these if set since it is never to be used by users.
if c.TestOnlyAllowRunAsCurrentUserWithoutChroot {