Skip to content

Commit b699e7e

Browse files
committed
libcontainer: intelrdt: add update command support
Add runc update command support for Intel RDT/CAT. for example: runc update --l3-cache-schema "L3:0=f;1=f" <container-id> Signed-off-by: Xiaochen Shen <[email protected]>
1 parent 593914b commit b699e7e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

update.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"strconv"
1010

1111
"github.com/docker/go-units"
12+
"github.com/opencontainers/runc/libcontainer/intelrdt"
1213
"github.com/opencontainers/runtime-spec/specs-go"
1314
"github.com/urfave/cli"
1415
)
@@ -112,6 +113,10 @@ other options are ignored.
112113
Name: "pids-limit",
113114
Usage: "Maximum number of pids allowed in the container",
114115
},
116+
cli.StringFlag{
117+
Name: "l3-cache-schema",
118+
Usage: "The string of Intel RDT/CAT L3 cache schema",
119+
},
115120
},
116121
Action: func(context *cli.Context) error {
117122
if err := checkArgs(context, 1, exactArgs); err != nil {
@@ -254,6 +259,14 @@ other options are ignored.
254259
config.Cgroups.Resources.MemorySwap = *r.Memory.Swap
255260
config.Cgroups.Resources.PidsLimit = r.Pids.Limit
256261

262+
if val := context.String("l3-cache-schema"); val != "" {
263+
// Avoid silent failure in container.Set()
264+
if !intelrdt.IsEnabled() || config.IntelRdt == nil {
265+
return fmt.Errorf("l3 cache schema is not enabled or not specified in config, update value '%s' is discarded", val)
266+
}
267+
config.IntelRdt.L3CacheSchema = val
268+
}
269+
257270
return container.Set(config)
258271
},
259272
}

0 commit comments

Comments
 (0)