add runc shim support for sched core
In linux 5.14 and hopefully some backports, core scheduling allows processes to be co scheduled within the same domain on SMT enabled systems. The containerd impl sets the core sched domain when launching a shim. This allows a clean way for each shim(container/pod) to be in its own domain and any additional containers, (v2 pods) be be launched with the same domain as well as any exec'd process added to the container. kernel docs: https://www.kernel.org/doc/html/latest/admin-guide/hw-vuln/core-scheduling.html Signed-off-by: Michael Crosby <michael@thepasture.io>
This commit is contained in:
@@ -35,12 +35,20 @@ import (
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
func shimBinary(bundle *Bundle, runtime, containerdAddress string, containerdTTRPCAddress string) *binary {
|
||||
type shimBinaryConfig struct {
|
||||
runtime string
|
||||
address string
|
||||
ttrpcAddress string
|
||||
schedCore bool
|
||||
}
|
||||
|
||||
func shimBinary(bundle *Bundle, config shimBinaryConfig) *binary {
|
||||
return &binary{
|
||||
bundle: bundle,
|
||||
runtime: runtime,
|
||||
containerdAddress: containerdAddress,
|
||||
containerdTTRPCAddress: containerdTTRPCAddress,
|
||||
runtime: config.runtime,
|
||||
containerdAddress: config.address,
|
||||
containerdTTRPCAddress: config.ttrpcAddress,
|
||||
schedCore: config.schedCore,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +56,7 @@ type binary struct {
|
||||
runtime string
|
||||
containerdAddress string
|
||||
containerdTTRPCAddress string
|
||||
schedCore bool
|
||||
bundle *Bundle
|
||||
}
|
||||
|
||||
@@ -61,13 +70,15 @@ func (b *binary) Start(ctx context.Context, opts *types.Any, onClose func()) (_
|
||||
|
||||
cmd, err := client.Command(
|
||||
ctx,
|
||||
b.runtime,
|
||||
b.containerdAddress,
|
||||
b.containerdTTRPCAddress,
|
||||
b.bundle.Path,
|
||||
opts,
|
||||
args...,
|
||||
)
|
||||
&client.CommandConfig{
|
||||
Runtime: b.runtime,
|
||||
Address: b.containerdAddress,
|
||||
TTRPCAddress: b.containerdTTRPCAddress,
|
||||
Path: b.bundle.Path,
|
||||
Opts: opts,
|
||||
Args: args,
|
||||
SchedCore: b.schedCore,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -138,14 +149,19 @@ func (b *binary) Delete(ctx context.Context) (*runtime.Exit, error) {
|
||||
}
|
||||
|
||||
cmd, err := client.Command(ctx,
|
||||
b.runtime,
|
||||
b.containerdAddress,
|
||||
b.containerdTTRPCAddress,
|
||||
bundlePath,
|
||||
nil,
|
||||
"-id", b.bundle.ID,
|
||||
"-bundle", b.bundle.Path,
|
||||
"delete")
|
||||
&client.CommandConfig{
|
||||
Runtime: b.runtime,
|
||||
Address: b.containerdAddress,
|
||||
TTRPCAddress: b.containerdTTRPCAddress,
|
||||
Path: bundlePath,
|
||||
Opts: nil,
|
||||
Args: []string{
|
||||
"-id", b.bundle.ID,
|
||||
"-bundle", b.bundle.Path,
|
||||
"delete",
|
||||
},
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
Reference in New Issue
Block a user