Skip to content
This repository has been archived by the owner on May 6, 2020. It is now read-only.

Commit

Permalink
KSM: Only setup when running as system instance
Browse files Browse the repository at this point in the history
Don't run KSM code when running a pod-specific instance.

Signed-off-by: James O. D. Hunt <[email protected]>
  • Loading branch information
jodh-intel committed Nov 13, 2017
1 parent c9af303 commit 2386a5a
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -751,15 +751,24 @@ func proxyMain(uri string) {
os.Exit(1)
}

// Init and tune KSM if available
proxyKSM, err = startKSM(defaultKSMRoot, proxyKSMMode)
if err != nil {
// KSM failure should not be fatal
fmt.Fprintln(os.Stderr, "init:", err.Error())
} else {
defer func() {
_ = proxyKSM.restore()
}()
// KSM is only available when running as a system-level daemon
// (where a URI is unecessary).
if !podInstance {
// Init and tune KSM if available
proxyKSM, err = startKSM(defaultKSMRoot, proxyKSMMode)
if err != nil {
// KSM failure should not be fatal
msg := "KSM setup failed"
if podInstance {
proxyLog.WithError(err).Warn(msg)
} else {
fmt.Fprintf(os.Stderr, "%s: %s\n", msg, err.Error())
}
} else {
defer func() {
_ = proxyKSM.restore()
}()
}
}

proxy.serve()
Expand Down Expand Up @@ -866,7 +875,7 @@ func main() {
"host the pprof server will be bound to")
flag.UintVar(&pprof.port, "pprof-port", 6060,
"port the pprof server will be bound to")
flag.StringVar(&uri, "uri", "", "proxy socket URI")
flag.StringVar(&uri, "uri", "", "proxy socket URI (note: disables KSM entirely)")

proxyKSMMode = defaultKSMMode

Expand Down

0 comments on commit 2386a5a

Please sign in to comment.