summaryrefslogtreecommitdiffhomepage
path: root/runsc/boot/loader.go
diff options
context:
space:
mode:
authorFabricio Voznika <fvoznika@google.com>2018-09-17 21:33:51 -0700
committerShentubot <shentubot@google.com>2018-09-17 21:34:37 -0700
commit5d9816be41a967fa1fa9bbbe0c638dd322c7c0b1 (patch)
tree69ce4df0c42bcd4f8788cd40238cecf903bede94 /runsc/boot/loader.go
parent26b08e182cd08371f14dc58fd54ed7865452cea7 (diff)
Remove memory usage static init
panic() during init() can be hard to debug. Updates #100 PiperOrigin-RevId: 213391932 Change-Id: Ic103f1981c5b48f1e12da3b42e696e84ffac02a9
Diffstat (limited to 'runsc/boot/loader.go')
-rw-r--r--runsc/boot/loader.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/runsc/boot/loader.go b/runsc/boot/loader.go
index 665240ab6..faaf3e800 100644
--- a/runsc/boot/loader.go
+++ b/runsc/boot/loader.go
@@ -42,6 +42,7 @@ import (
"gvisor.googlesource.com/gvisor/pkg/sentry/sighandling"
slinux "gvisor.googlesource.com/gvisor/pkg/sentry/syscalls/linux"
"gvisor.googlesource.com/gvisor/pkg/sentry/time"
+ "gvisor.googlesource.com/gvisor/pkg/sentry/usage"
"gvisor.googlesource.com/gvisor/pkg/sentry/watchdog"
"gvisor.googlesource.com/gvisor/pkg/tcpip"
"gvisor.googlesource.com/gvisor/pkg/tcpip/link/sniffer"
@@ -143,6 +144,9 @@ func init() {
// New initializes a new kernel loader configured by spec.
// New also handles setting up a kernel for restoring a container.
func New(spec *specs.Spec, conf *Config, controllerFD, deviceFD int, goferFDs []int, console bool) (*Loader, error) {
+ if err := usage.Init(); err != nil {
+ return nil, fmt.Errorf("Error setting up memory usage: %v", err)
+ }
// Create kernel and platform.
p, err := createPlatform(conf, deviceFD)
if err != nil {