diff --git a/enterprise/server/remote_execution/cgroup/cgroup.go b/enterprise/server/remote_execution/cgroup/cgroup.go index 2d14f5f0a6a..c44faee0be2 100644 --- a/enterprise/server/remote_execution/cgroup/cgroup.go +++ b/enterprise/server/remote_execution/cgroup/cgroup.go @@ -84,7 +84,7 @@ func settingsMap(s *scpb.CgroupSettings, blockDevice *block_io.Device) map[strin if s.CpuQuotaLimitUsec != nil { if s.CpuQuotaPeriodUsec == nil { // Keep current or default period (100ms) but update quota. - m["cpu.max"] = strconv.Itoa(int(s.GetCpuQuotaPeriodUsec())) + m["cpu.max"] = strconv.Itoa(int(s.GetCpuQuotaLimitUsec())) } else { m["cpu.max"] = fmt.Sprintf("%d %d", s.GetCpuQuotaLimitUsec(), s.GetCpuQuotaPeriodUsec()) } diff --git a/enterprise/server/remote_execution/cgroup/cgroup_test.go b/enterprise/server/remote_execution/cgroup/cgroup_test.go index 67783a4d685..e66ec96c623 100644 --- a/enterprise/server/remote_execution/cgroup/cgroup_test.go +++ b/enterprise/server/remote_execution/cgroup/cgroup_test.go @@ -73,6 +73,15 @@ func TestSettingsMap(t *testing.T) { "io.max": "279:8 riops=1000 wiops=500 rbps=4096000 wbps=1024000", }, }, + { + name: "write cpu quota without limit", + settings: &scpb.CgroupSettings{ + CpuQuotaLimitUsec: proto.Int64(300_000), + }, + expectedMap: map[string]string{ + "cpu.max": "300000", + }, + }, } { t.Run(test.name, func(t *testing.T) { device := &block_io.Device{Maj: 279, Min: 8}