github.com/intel/goresctrl@v0.5.0/pkg/cgroups/cgrouppath.go (about) 1 // Copyright 2020 Intel Corporation. All Rights Reserved. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package cgroups 16 17 import ( 18 goresctrlpath "github.com/intel/goresctrl/pkg/path" 19 ) 20 21 // nolint 22 const ( 23 // Tasks is a cgroup's "tasks" entry. 24 Tasks = "tasks" 25 // Procs is cgroup's "cgroup.procs" entry. 26 Procs = "cgroup.procs" 27 // CpuShares is the cpu controller's "cpu.shares" entry. 28 CpuShares = "cpu.shares" 29 // CpuPeriod is the cpu controller's "cpu.cfs_period_us" entry. 30 CpuPeriod = "cpu.cfs_period_us" 31 // CpuQuota is the cpu controller's "cpu.cfs_quota_us" entry. 32 CpuQuota = "cpu.cfs_quota_us" 33 // CpusetCpus is the cpuset controller's cpuset.cpus entry. 34 CpusetCpus = "cpuset.cpus" 35 // CpusetMems is the cpuset controller's cpuset.mems entry. 36 CpusetMems = "cpuset.mems" 37 ) 38 39 const cgroupBasePath = "sys/fs/cgroup" 40 41 // GetMountDir returns the common mount point for cgroup v1 controllers. 42 func GetMountDir() string { 43 return cgroupPath() 44 } 45 46 // GetV2Dir returns the cgroup v2 unified mount directory. 47 func GetV2Dir() string { 48 return cgroupPath("unified") 49 } 50 51 func cgroupPath(elems ...string) string { 52 return goresctrlpath.Path(append([]string{cgroupBasePath}, elems...)...) 53 }