-
Notifications
You must be signed in to change notification settings - Fork 2.2k
libcontainer/intelrdt: add support for EnableMonitoring field #4832
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
base: main
Are you sure you want to change the base?
Conversation
520aadd
to
d141fb0
Compare
libcontainer/intelrdt/intelrdt.go
Outdated
if m.config.IntelRdt.ClosID == "" { | ||
m.mu.Lock() | ||
defer m.mu.Unlock() | ||
if err := os.RemoveAll(m.GetPath()); err != nil { |
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.
RemoveAll is kind of dangerous. Can we use os.Remove() here instead?
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.
Check, changed as suggested. Added as a separate commit. I also submitted this commit as a separate PR #4840
libcontainer/intelrdt/intelrdt.go
Outdated
} else if monPath := m.GetMonPath(); monPath != "" { | ||
// If ClosID is not specified the possible monintoring group was | ||
// removed with the CLOS above. | ||
if err := os.RemoveAll(monPath); err != nil { |
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.
idem
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.
Changed as suggested. See also #4840
libcontainer/intelrdt/intelrdt.go
Outdated
// monitoring group. | ||
func (m *Manager) GetMonPath() string { | ||
if closPath := m.GetPath(); closPath != "" && m.config.IntelRdt.EnableMonitoring { | ||
return filepath.Join(closPath, "mon_groups", m.id) |
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.
securejoin is at least better here
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.
Changed as suggested
libcontainer/intelrdt/intelrdt.go
Outdated
@@ -474,6 +474,16 @@ func (m *Manager) Apply(pid int) (err error) { | |||
return newLastCmdError(err) | |||
} | |||
|
|||
// Create MON group | |||
if monPath := m.GetMonPath(); monPath != "" { | |||
if err := os.MkdirAll(monPath, 0o755); err != nil { |
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.
Where is this path? Inside the container? On the host?
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.
This is on the host (now changed to Mkdir)
169609d
to
4024488
Compare
4024488
to
86329fe
Compare
Signed-off-by: Markus Lehtonen <[email protected]>
86329fe
to
2380794
Compare
Rebased |
The linux.intelRdt.enableMonitoring field enables the creation of a per-container monitoring group. The monitoring group is removed when the container is destroyed. Signed-off-by: Markus Lehtonen <[email protected]>
2380794
to
e31d98c
Compare
The linux.intelRdt.enableMonitoring field enables the creation of a per-container monitoring group. The monitoring group is removed when the container is destroyed.
Refs: opencontainers/runtime-spec#1287