Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
cgroups: add ability to update CPUSet
Browse files Browse the repository at this point in the history
add function for applying a CPUset change to a cgroup

Signed-off-by: Eric Ernst <eric@amperecomputing.com>
  • Loading branch information
Eric Ernst committed Jul 16, 2020
1 parent 9fa2bf1 commit 093aaa8
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions virtcontainers/pkg/cgroups/manager.go
Expand Up @@ -331,3 +331,16 @@ func (m *Manager) RemoveDevice(device string) error {
m.Unlock()
return fmt.Errorf("device %v not found in the cgroup", device)
}

func (m *Manager) SetCPUSet(cpuset string) error {
cgroups, err := m.GetCgroups()
if err != nil {
return err
}

m.Lock()
cgroups.CpusetCpus = cpuset
m.Unlock()

return m.Apply()
}

0 comments on commit 093aaa8

Please sign in to comment.