diff options
author | Aleksandr Razumov <ar@gortc.io> | 2019-12-15 20:57:23 +0300 |
---|---|---|
committer | Aleksandr Razumov <ar@gortc.io> | 2019-12-15 21:12:43 +0300 |
commit | 8782f0e287df2a2fd9f9dfb3f0e1589cc15a4f91 (patch) | |
tree | d08d7f3a04d700b2edc2538d80ef9d3f0137989c /runsc/main.go | |
parent | 6b424530397e5100b08628efe8f6c62178daa70b (diff) |
Set CPU number to CPU quota
When application is not cgroups-aware, it can spawn excessive threads
which often defaults to CPU number.
Introduce a opt-in flag that will set CPU number accordingly to CPU
quota (if available).
Fixes #1391
Diffstat (limited to 'runsc/main.go')
-rw-r--r-- | runsc/main.go | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/runsc/main.go b/runsc/main.go index 4682b308c..febd59aed 100644 --- a/runsc/main.go +++ b/runsc/main.go @@ -82,6 +82,7 @@ var ( numNetworkChannels = flag.Int("num-network-channels", 1, "number of underlying channels(FDs) to use for network link endpoints.") rootless = flag.Bool("rootless", false, "it allows the sandbox to be started with a user that is not root. Sandbox and Gofer processes may run with same privileges as current user.") referenceLeakMode = flag.String("ref-leak-mode", "disabled", "sets reference leak check mode: disabled (default), log-names, log-traces.") + cpuNumFromQuota = flag.Bool("cpu-num-from-quota", false, "set cpu number to cpu quota (least integer greater than quota value)") // Test flags, not to be used outside tests, ever. testOnlyAllowRunAsCurrentUserWithoutChroot = flag.Bool("TESTONLY-unsafe-nonroot", false, "TEST ONLY; do not ever use! This skips many security measures that isolate the host from the sandbox.") @@ -225,6 +226,7 @@ func main() { AlsoLogToStderr: *alsoLogToStderr, ReferenceLeakMode: refsLeakMode, OverlayfsStaleRead: *overlayfsStaleRead, + CPUNumFromQuota: *cpuNumFromQuota, TestOnlyAllowRunAsCurrentUserWithoutChroot: *testOnlyAllowRunAsCurrentUserWithoutChroot, TestOnlyTestNameEnv: *testOnlyTestNameEnv, |