summaryrefslogtreecommitdiffhomepage
path: root/runsc/cgroup
diff options
context:
space:
mode:
authorAdin Scannell <ascannell@google.com>2021-01-12 12:36:17 -0800
committergVisor bot <gvisor-bot@google.com>2021-01-12 12:38:22 -0800
commit4e03e87547853523d4ff941935a6ef1712518c61 (patch)
treee930ce0e5f15f7041e7b74daca05acc7afbd2558 /runsc/cgroup
parenta20da708291e2e5bdece5176dce61c1b4b10b7d9 (diff)
Fix simple mistakes identified by goreportcard.
These are primarily simplification and lint mistakes. However, minor fixes are also included and tests added where appropriate. PiperOrigin-RevId: 351425971
Diffstat (limited to 'runsc/cgroup')
-rw-r--r--runsc/cgroup/cgroup.go27
1 files changed, 14 insertions, 13 deletions
diff --git a/runsc/cgroup/cgroup.go b/runsc/cgroup/cgroup.go
index e5294de55..13c6a16a0 100644
--- a/runsc/cgroup/cgroup.go
+++ b/runsc/cgroup/cgroup.go
@@ -41,22 +41,22 @@ const (
)
var controllers = map[string]config{
- "blkio": config{ctrlr: &blockIO{}},
- "cpu": config{ctrlr: &cpu{}},
- "cpuset": config{ctrlr: &cpuSet{}},
- "hugetlb": config{ctrlr: &hugeTLB{}, optional: true},
- "memory": config{ctrlr: &memory{}},
- "net_cls": config{ctrlr: &networkClass{}},
- "net_prio": config{ctrlr: &networkPrio{}},
- "pids": config{ctrlr: &pids{}},
+ "blkio": {ctrlr: &blockIO{}},
+ "cpu": {ctrlr: &cpu{}},
+ "cpuset": {ctrlr: &cpuSet{}},
+ "hugetlb": {ctrlr: &hugeTLB{}, optional: true},
+ "memory": {ctrlr: &memory{}},
+ "net_cls": {ctrlr: &networkClass{}},
+ "net_prio": {ctrlr: &networkPrio{}},
+ "pids": {ctrlr: &pids{}},
// These controllers either don't have anything in the OCI spec or is
// irrelevant for a sandbox.
- "devices": config{ctrlr: &noop{}},
- "freezer": config{ctrlr: &noop{}},
- "perf_event": config{ctrlr: &noop{}},
- "rdma": config{ctrlr: &noop{}, optional: true},
- "systemd": config{ctrlr: &noop{}},
+ "devices": {ctrlr: &noop{}},
+ "freezer": {ctrlr: &noop{}},
+ "perf_event": {ctrlr: &noop{}},
+ "rdma": {ctrlr: &noop{}, optional: true},
+ "systemd": {ctrlr: &noop{}},
}
func setOptionalValueInt(path, name string, val *int64) error {
@@ -371,6 +371,7 @@ func (c *Cgroup) Join() (func(), error) {
return undo, nil
}
+// CPUQuota returns the CFS CPU quota.
func (c *Cgroup) CPUQuota() (float64, error) {
path := c.makePath("cpu")
quota, err := getInt(path, "cpu.cfs_quota_us")