-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Closed
Description
runc/libcontainer/cgroups/fs/cpu_v2.go
Lines 32 to 42 in c4d8e16
| func (s *CpuGroupV2) ApplyDir(path string, cgroup *configs.Cgroup, pid int) error { | |
| // This might happen if we have no cpu cgroup mounted. | |
| // Just do nothing and don't fail. | |
| if path == "" { | |
| return nil | |
| } | |
| if err := os.MkdirAll(path, 0755); err != nil { | |
| return err | |
| } | |
| return cgroups.WriteCgroupProc(path, pid) | |
| } |
v2 subsystems should not call WriteCgroupProc(), because it should be managed by Manager rather than each of subsystems for unified mode
The subsystem interface should be modified like this:
diff --git a/libcontainer/cgroups/fs/apply_raw.go b/libcontainer/cgroups/fs/apply_raw.go
index 512fd700..66ab43ec 100644
--- a/libcontainer/cgroups/fs/apply_raw.go
+++ b/libcontainer/cgroups/fs/apply_raw.go
@@ -58,20 +58,24 @@ func (s subsystemSet) Get(name string) (subsystem, error) {
}
type subsystem interface {
// Name returns the name of the subsystem.
Name() string
// Returns the stats, as 'stats', corresponding to the cgroup under 'path'.
GetStats(path string, stats *cgroups.Stats) error
+ // Set the cgroup represented by cgroup.
+ Set(path string, cgroup *configs.Cgroup) error
+}
+
+type subsystemV1 interface {
+ subsystem
// Removes the cgroup represented by 'cgroupData'.
Remove(*cgroupData) error
// Creates and joins the cgroup represented by 'cgroupData'.
Apply(*cgroupData) error
- // Set the cgroup represented by cgroup.
- Set(path string, cgroup *configs.Cgroup) error
}
type Manager struct {
mu sync.Mutex
Cgroups *configs.Cgroup
Rootless bool // ignore permission-related errors
Paths map[string]stringReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels