intelrdt: always init IntelRdtManager if Intel RDT is enabled
In current implementation: Either Intel RDT is not enabled by hardware and kernel, or intelRdt is not specified in original config, we don't init IntelRdtManager in the container to handle intelrdt constraint. It is a tradeoff that Intel RDT has hardware limitation to support only limited number of groups. This patch makes a minor change to support update command: Whether or not intelRdt is specified in config, we always init IntelRdtManager in the container if Intel RDT is enabled. If intelRdt is not specified in original config, we just don't Apply() to create intelrdt group or attach tasks for this container. In update command, we could re-enable through IntelRdtManager.Apply() and then update intelrdt constraint. Signed-off-by: Xiaochen Shen <xiaochen.shen@intel.com>
This commit is contained in:
parent
593914b8bd
commit
2549545df5
|
@ -213,8 +213,7 @@ func (l *LinuxFactory) Create(id string, config *configs.Config) (Container, err
|
|||
newgidmapPath: l.NewgidmapPath,
|
||||
cgroupManager: l.NewCgroupsManager(config.Cgroups, nil),
|
||||
}
|
||||
c.intelRdtManager = nil
|
||||
if intelrdt.IsEnabled() && c.config.IntelRdt != nil {
|
||||
if intelrdt.IsEnabled() {
|
||||
c.intelRdtManager = l.NewIntelRdtManager(config, id, "")
|
||||
}
|
||||
c.state = &stoppedState{c: c}
|
||||
|
@ -256,8 +255,7 @@ func (l *LinuxFactory) Load(id string) (Container, error) {
|
|||
if err := c.refreshState(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
c.intelRdtManager = nil
|
||||
if intelrdt.IsEnabled() && c.config.IntelRdt != nil {
|
||||
if intelrdt.IsEnabled() {
|
||||
c.intelRdtManager = l.NewIntelRdtManager(&state.Config, id, state.IntelRdtPath)
|
||||
}
|
||||
return c, nil
|
||||
|
|
|
@ -401,6 +401,10 @@ func GetIntelRdtPath(id string) (string, error) {
|
|||
|
||||
// Applies Intel RDT configuration to the process with the specified pid
|
||||
func (m *IntelRdtManager) Apply(pid int) (err error) {
|
||||
// If intelRdt is not specified in config, we do nothing
|
||||
if m.Config.IntelRdt == nil {
|
||||
return nil
|
||||
}
|
||||
d, err := getIntelRdtData(m.Config, pid)
|
||||
if err != nil && !IsNotFound(err) {
|
||||
return err
|
||||
|
|
Loading…
Reference in New Issue