summaryrefslogtreecommitdiffhomepage
path: root/runsc/boot/loader.go
diff options
context:
space:
mode:
authorFabricio Voznika <fvoznika@google.com>2018-06-15 09:17:40 -0700
committerShentubot <shentubot@google.com>2018-06-15 09:19:04 -0700
commitef5dd4df9b65fb98d952b83baa736c14b2627fe7 (patch)
tree979aace7f5067ff0d3b12469d14202214f118d60 /runsc/boot/loader.go
parent119a302ceb070243cc2d3d3b4dcf5f4d57809479 (diff)
Set kernel.applicationCores to the number of processor on the host
The right number to use is the number of processors assigned to the cgroup. But until we make the sandbox join the respective cgroup, just use the number of processors on the host. Closes #65, closes #66 PiperOrigin-RevId: 200725483 Change-Id: I34a566b1a872e26c66f56fa6e3100f42aaf802b1
Diffstat (limited to 'runsc/boot/loader.go')
-rw-r--r--runsc/boot/loader.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/runsc/boot/loader.go b/runsc/boot/loader.go
index 4a6528307..89300a953 100644
--- a/runsc/boot/loader.go
+++ b/runsc/boot/loader.go
@@ -18,6 +18,7 @@ package boot
import (
"fmt"
"math/rand"
+ "runtime"
"sync/atomic"
"syscall"
gtime "time"
@@ -171,10 +172,11 @@ func New(spec *specs.Spec, conf *Config, controllerFD int, ioFDs []int, console
Timekeeper: tk,
RootUserNamespace: creds.UserNamespace,
NetworkStack: networkStack,
- ApplicationCores: 8,
- Vdso: vdso,
- RootUTSNamespace: utsns,
- RootIPCNamespace: ipcns,
+ // TODO: use number of logical processors from cgroups.
+ ApplicationCores: uint(runtime.NumCPU()),
+ Vdso: vdso,
+ RootUTSNamespace: utsns,
+ RootIPCNamespace: ipcns,
}); err != nil {
return nil, fmt.Errorf("error initializing kernel: %v", err)
}