-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Faster Intel RDT init if the feature is unavailable #3306
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -276,35 +276,30 @@ func findIntelRdtMountpointDir(f io.Reader) (string, error) { | |
|
||
// For Root() use only. | ||
var ( | ||
intelRdtRoot string | ||
rootMu sync.Mutex | ||
intelRdtRoot string | ||
intelRdtRootErr error | ||
rootOnce sync.Once | ||
) | ||
|
||
// Root returns the Intel RDT "resource control" filesystem mount point. | ||
func Root() (string, error) { | ||
rootMu.Lock() | ||
defer rootMu.Unlock() | ||
|
||
if intelRdtRoot != "" { | ||
return intelRdtRoot, nil | ||
} | ||
|
||
f, err := os.Open("/proc/self/mountinfo") | ||
if err != nil { | ||
return "", err | ||
} | ||
root, err := findIntelRdtMountpointDir(f) | ||
f.Close() | ||
if err != nil { | ||
return "", err | ||
} | ||
rootOnce.Do(func() { | ||
f, err := os.Open("/proc/self/mountinfo") | ||
if err != nil { | ||
intelRdtRootErr = err | ||
return | ||
} | ||
root, err := findIntelRdtMountpointDir(f) | ||
f.Close() | ||
if err != nil { | ||
intelRdtRootErr = err | ||
return | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we have to take into account that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think so. If we do, we have to re-read /proc/self/mountinfo over and over (assuming it's some long-lived daemon that imports libcontainer/intelrdt, such as kubelet; for runc itself it's not a issue, since it's a short-lived binary). I suppose that resctrl is mounted during system init, and it should be mounted by the time we start runc or e.g. kubernetes. If not, it's a configuration issue. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. K, fair enough There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Are there specific systemd targets to take this into account and that should be recommended for that? I know containerd has
|
||
|
||
if _, err := os.Stat(root); err != nil { | ||
return "", err | ||
} | ||
intelRdtRoot = root | ||
}) | ||
|
||
intelRdtRoot = root | ||
return intelRdtRoot, nil | ||
return intelRdtRoot, intelRdtRootErr | ||
} | ||
|
||
type cpuInfoFlags struct { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess technically we wouldn't need the intermediate
root
anderr
variables (no need to change)