tasks: add Linux rdt support
Add support for configuring the Linux resctrl pseudo-filesystem with goresctrl library. The functionality is integrated in the "io.containerd.service.v1.tasks-service" plugin. Signed-off-by: Markus Lehtonen <markus.lehtonen@intel.com>
This commit is contained in:
parent
9e755d12e2
commit
eae14688c6
@ -104,6 +104,12 @@ documentation.
|
|||||||
- **sched_core** Core scheduling is a feature that allows only trusted tasks
|
- **sched_core** Core scheduling is a feature that allows only trusted tasks
|
||||||
to run concurrently on cpus sharing compute resources (eg: hyperthreads on
|
to run concurrently on cpus sharing compute resources (eg: hyperthreads on
|
||||||
a core). (Default: **false**)
|
a core). (Default: **false**)
|
||||||
|
- **[plugins."io.containerd.service.v1.tasks-service"]** has one option:
|
||||||
|
- **rdt_config_file** (Linux only) specifies path to a configuration used for
|
||||||
|
configuring RDT (Default: **""**). Enables support for Intel RDT, a
|
||||||
|
technology for cache and memory bandwidth management.
|
||||||
|
See https://github.com/intel/goresctrl/blob/v0.2.0/doc/rdt.md#configuration
|
||||||
|
for details of the configuration file format.
|
||||||
|
|
||||||
**oom_score**
|
**oom_score**
|
||||||
: The out of memory (OOM) score applied to the containerd daemon process (Default: 0)
|
: The out of memory (OOM) score applied to the containerd daemon process (Default: 0)
|
||||||
@ -193,6 +199,8 @@ imports = ["/etc/containerd/runtime_*.toml", "./debug.toml"]
|
|||||||
[plugins."io.containerd.runtime-shim.v2.shim"]
|
[plugins."io.containerd.runtime-shim.v2.shim"]
|
||||||
platforms = ["linux/amd64"]
|
platforms = ["linux/amd64"]
|
||||||
sched_core = true
|
sched_core = true
|
||||||
|
[plugins."io.containerd.service.v1.tasks-service"]
|
||||||
|
rdt_config_file = "/etc/rdt-config.yaml"
|
||||||
```
|
```
|
||||||
|
|
||||||
## BUGS
|
## BUGS
|
||||||
|
@ -63,11 +63,18 @@ const (
|
|||||||
stateTimeout = "io.containerd.timeout.task.state"
|
stateTimeout = "io.containerd.timeout.task.state"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Config for the tasks service plugin
|
||||||
|
type Config struct {
|
||||||
|
// RdtConfigFile specifies the path to RDT configuration file
|
||||||
|
RdtConfigFile string `toml:"rdt_config_file" json:"rdtConfigFile"`
|
||||||
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.ServicePlugin,
|
Type: plugin.ServicePlugin,
|
||||||
ID: services.TasksService,
|
ID: services.TasksService,
|
||||||
Requires: tasksServiceRequires,
|
Requires: tasksServiceRequires,
|
||||||
|
Config: &Config{},
|
||||||
InitFn: initFunc,
|
InitFn: initFunc,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -75,6 +82,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func initFunc(ic *plugin.InitContext) (interface{}, error) {
|
func initFunc(ic *plugin.InitContext) (interface{}, error) {
|
||||||
|
config := ic.Config.(*Config)
|
||||||
runtimes, err := loadV1Runtimes(ic)
|
runtimes, err := loadV1Runtimes(ic)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -128,6 +136,11 @@ func initFunc(ic *plugin.InitContext) (interface{}, error) {
|
|||||||
for _, t := range v2Tasks {
|
for _, t := range v2Tasks {
|
||||||
l.monitor.Monitor(t, nil)
|
l.monitor.Monitor(t, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err := initRdt(config.RdtConfigFile); err != nil {
|
||||||
|
log.G(ic.Context).WithError(err).Errorf("RDT initialization failed")
|
||||||
|
}
|
||||||
|
|
||||||
return l, nil
|
return l, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
24
services/tasks/rdt_default.go
Normal file
24
services/tasks/rdt_default.go
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
//go:build !linux || no_rdt
|
||||||
|
// +build !linux no_rdt
|
||||||
|
|
||||||
|
/*
|
||||||
|
Copyright The containerd Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package tasks
|
||||||
|
|
||||||
|
func RdtEnabled() bool { return false }
|
||||||
|
|
||||||
|
func initRdt(configFilePath string) error { return nil }
|
50
services/tasks/rdt_linux.go
Normal file
50
services/tasks/rdt_linux.go
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
//go:build linux && !no_rdt
|
||||||
|
// +build linux,!no_rdt
|
||||||
|
|
||||||
|
/*
|
||||||
|
Copyright The containerd Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package tasks
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/containerd/containerd/log"
|
||||||
|
|
||||||
|
"github.com/intel/goresctrl/pkg/rdt"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// ResctrlPrefix is the prefix used for class/closid directories under the resctrl filesystem
|
||||||
|
ResctrlPrefix = ""
|
||||||
|
)
|
||||||
|
|
||||||
|
func initRdt(configFilePath string) error {
|
||||||
|
if configFilePath == "" {
|
||||||
|
log.L.Debug("No RDT config file specified, RDT not configured")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := rdt.Initialize(ResctrlPrefix); err != nil {
|
||||||
|
return errors.Wrap(err, "RDT not enabled")
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := rdt.SetConfigFromFile(configFilePath, true); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user