Skip to content

Commit f570ef0

Browse files
author
Paweł Szulik
committed
Add mon groups for resctrl.
"mon_groups" can be created to monitor subsets of tasks in the CTRL_MON group that is their ancestor. More info: https://www.kernel.org/doc/Documentation/x86/intel_rdt_ui.txt Signed-off-by: Paweł Szulik <[email protected]>
1 parent 9d4c02c commit f570ef0

File tree

8 files changed

+209
-92
lines changed

8 files changed

+209
-92
lines changed

events.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,12 @@ func convertLibcontainerStats(ls *libcontainer.Stats) *types.Stats {
154154
}
155155

156156
if is := ls.IntelRdtStats; is != nil {
157-
if intelrdt.IsCatEnabled() {
157+
if intelrdt.IsCatEnabled() && is.L3CacheInfo != nil {
158158
s.IntelRdt.L3CacheInfo = convertL3CacheInfo(is.L3CacheInfo)
159159
s.IntelRdt.L3CacheSchemaRoot = is.L3CacheSchemaRoot
160160
s.IntelRdt.L3CacheSchema = is.L3CacheSchema
161161
}
162-
if intelrdt.IsMbaEnabled() {
162+
if intelrdt.IsMbaEnabled() && is.MemBwInfo != nil{
163163
s.IntelRdt.MemBwInfo = convertMemBwInfo(is.MemBwInfo)
164164
s.IntelRdt.MemBwSchemaRoot = is.MemBwSchemaRoot
165165
s.IntelRdt.MemBwSchema = is.MemBwSchema

libcontainer/configs/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ type Config struct {
192192
NoNewKeyring bool `json:"no_new_keyring"`
193193

194194
// IntelRdt specifies settings for Intel RDT group that the container is placed into
195-
// to limit the resources (e.g., L3 cache, memory bandwidth) the container has available
195+
// to limit the resources (e.g., L3 cache, memory bandwidth) the container has available.
196196
IntelRdt *IntelRdt `json:"intel_rdt,omitempty"`
197197

198198
// RootlessEUID is set when the runc was launched with non-zero EUID.

libcontainer/configs/validate/validator.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,23 +182,31 @@ func (v *ConfigValidator) sysctl(config *configs.Config) error {
182182

183183
func (v *ConfigValidator) intelrdt(config *configs.Config) error {
184184
if config.IntelRdt != nil {
185+
/*
185186
if !intelrdt.IsCatEnabled() && !intelrdt.IsMbaEnabled() {
186187
return errors.New("intelRdt is specified in config, but Intel RDT is not supported or enabled")
187188
}
188-
189+
*/
189190
if !intelrdt.IsCatEnabled() && config.IntelRdt.L3CacheSchema != "" {
190191
return errors.New("intelRdt.l3CacheSchema is specified in config, but Intel RDT/CAT is not enabled")
191192
}
192193
if !intelrdt.IsMbaEnabled() && config.IntelRdt.MemBwSchema != "" {
193194
return errors.New("intelRdt.memBwSchema is specified in config, but Intel RDT/MBA is not enabled")
194195
}
195196

197+
if !intelrdt.IsMBMEnabled() && config.IntelRdt.L3CacheSchema == "" && config.IntelRdt.MemBwSchema == "" {
198+
return errors.New("intelRdt is pecified in config, but Intel RDT/MBM is not enabled")
199+
}
200+
201+
/*
196202
if intelrdt.IsCatEnabled() && config.IntelRdt.L3CacheSchema == "" {
197203
return errors.New("Intel RDT/CAT is enabled and intelRdt is specified in config, but intelRdt.l3CacheSchema is empty")
198204
}
199205
if intelrdt.IsMbaEnabled() && config.IntelRdt.MemBwSchema == "" {
200206
return errors.New("Intel RDT/MBA is enabled and intelRdt is specified in config, but intelRdt.memBwSchema is empty")
201207
}
208+
209+
*/
202210
}
203211

204212
return nil

libcontainer/container_linux.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1852,10 +1852,6 @@ func (c *linuxContainer) currentState() (*State, error) {
18521852
startTime, _ = c.initProcess.startTime()
18531853
externalDescriptors = c.initProcess.externalDescriptors()
18541854
}
1855-
intelRdtPath, err := intelrdt.GetIntelRdtPath(c.ID())
1856-
if err != nil {
1857-
intelRdtPath = ""
1858-
}
18591855
state := &State{
18601856
BaseState: BaseState{
18611857
ID: c.ID(),
@@ -1866,7 +1862,7 @@ func (c *linuxContainer) currentState() (*State, error) {
18661862
},
18671863
Rootless: c.config.RootlessEUID && c.config.RootlessCgroups,
18681864
CgroupPaths: c.cgroupManager.GetPaths(),
1869-
IntelRdtPath: intelRdtPath,
1865+
IntelRdtPath: c.intelRdtManager.GetPath(),
18701866
NamespacePaths: make(map[configs.NamespaceType]string),
18711867
ExternalDescriptors: externalDescriptors,
18721868
}

libcontainer/factory_linux.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,14 +313,13 @@ func (l *LinuxFactory) Load(id string) (Container, error) {
313313
cgroupManager: l.NewCgroupsManager(state.Config.Cgroups, state.CgroupPaths),
314314
root: containerRoot,
315315
created: state.Created,
316+
intelRdtManager: l.NewIntelRdtManager(&state.Config, id, state.IntelRdtPath),
316317
}
317318
c.state = &loadedState{c: c}
318319
if err := c.refreshState(); err != nil {
319320
return nil, err
320321
}
321-
if intelrdt.IsCatEnabled() || intelrdt.IsMbaEnabled() {
322-
c.intelRdtManager = l.NewIntelRdtManager(&state.Config, id, state.IntelRdtPath)
323-
}
322+
324323
return c, nil
325324
}
326325

0 commit comments

Comments
 (0)