github.com/zhuohuang-hust/src-cbuild@v0.0.0-20230105071821-c7aab3e7c840/mergeCode/runc/libcontainer/configs/cgroup_unix.go (about)

     1  // +build linux freebsd
     2  
     3  package configs
     4  
     5  type FreezerState string
     6  
     7  const (
     8  	Undefined FreezerState = ""
     9  	Frozen    FreezerState = "FROZEN"
    10  	Thawed    FreezerState = "THAWED"
    11  )
    12  
    13  type Cgroup struct {
    14  	// Deprecated, use Path instead
    15  	Name string `json:"name,omitempty"`
    16  
    17  	// name of parent of cgroup or slice
    18  	// Deprecated, use Path instead
    19  	Parent string `json:"parent,omitempty"`
    20  
    21  	// Path specifies the path to cgroups that are created and/or joined by the container.
    22  	// The path is assumed to be relative to the host system cgroup mountpoint.
    23  	Path string `json:"path"`
    24  
    25  	// ScopePrefix describes prefix for the scope name
    26  	ScopePrefix string `json:"scope_prefix"`
    27  
    28  	// Paths represent the absolute cgroups paths to join.
    29  	// This takes precedence over Path.
    30  	Paths map[string]string
    31  
    32  	// Resources contains various cgroups settings to apply
    33  	*Resources
    34  }
    35  
    36  type Resources struct {
    37  	// If this is true allow access to any kind of device within the container.  If false, allow access only to devices explicitly listed in the allowed_devices list.
    38  	// Deprecated
    39  	AllowAllDevices *bool `json:"allow_all_devices,omitempty"`
    40  	// Deprecated
    41  	AllowedDevices []*Device `json:"allowed_devices,omitempty"`
    42  	// Deprecated
    43  	DeniedDevices []*Device `json:"denied_devices,omitempty"`
    44  
    45  	Devices []*Device `json:"devices"`
    46  
    47  	// Memory limit (in bytes)
    48  	Memory int64 `json:"memory"`
    49  
    50  	// Memory reservation or soft_limit (in bytes)
    51  	MemoryReservation int64 `json:"memory_reservation"`
    52  
    53  	// Total memory usage (memory + swap); set `-1` to enable unlimited swap
    54  	MemorySwap int64 `json:"memory_swap"`
    55  
    56  	// Kernel memory limit (in bytes)
    57  	KernelMemory int64 `json:"kernel_memory"`
    58  
    59  	// Kernel memory limit for TCP use (in bytes)
    60  	KernelMemoryTCP int64 `json:"kernel_memory_tcp"`
    61  
    62  	// CPU shares (relative weight vs. other containers)
    63  	CpuShares int64 `json:"cpu_shares"`
    64  
    65  	// CPU hardcap limit (in usecs). Allowed cpu time in a given period.
    66  	CpuQuota int64 `json:"cpu_quota"`
    67  
    68  	// CPU period to be used for hardcapping (in usecs). 0 to use system default.
    69  	CpuPeriod int64 `json:"cpu_period"`
    70  
    71  	// How many time CPU will use in realtime scheduling (in usecs).
    72  	CpuRtRuntime int64 `json:"cpu_rt_quota"`
    73  
    74  	// CPU period to be used for realtime scheduling (in usecs).
    75  	CpuRtPeriod int64 `json:"cpu_rt_period"`
    76  
    77  	// CPU to use
    78  	CpusetCpus string `json:"cpuset_cpus"`
    79  
    80  	// MEM to use
    81  	CpusetMems string `json:"cpuset_mems"`
    82  
    83  	// Process limit; set <= `0' to disable limit.
    84  	PidsLimit int64 `json:"pids_limit"`
    85  
    86  	// Specifies per cgroup weight, range is from 10 to 1000.
    87  	BlkioWeight uint16 `json:"blkio_weight"`
    88  
    89  	// Specifies tasks' weight in the given cgroup while competing with the cgroup's child cgroups, range is from 10 to 1000, cfq scheduler only
    90  	BlkioLeafWeight uint16 `json:"blkio_leaf_weight"`
    91  
    92  	// Weight per cgroup per device, can override BlkioWeight.
    93  	BlkioWeightDevice []*WeightDevice `json:"blkio_weight_device"`
    94  
    95  	// IO read rate limit per cgroup per device, bytes per second.
    96  	BlkioThrottleReadBpsDevice []*ThrottleDevice `json:"blkio_throttle_read_bps_device"`
    97  
    98  	// IO write rate limit per cgroup per device, bytes per second.
    99  	BlkioThrottleWriteBpsDevice []*ThrottleDevice `json:"blkio_throttle_write_bps_device"`
   100  
   101  	// IO read rate limit per cgroup per device, IO per second.
   102  	BlkioThrottleReadIOPSDevice []*ThrottleDevice `json:"blkio_throttle_read_iops_device"`
   103  
   104  	// IO write rate limit per cgroup per device, IO per second.
   105  	BlkioThrottleWriteIOPSDevice []*ThrottleDevice `json:"blkio_throttle_write_iops_device"`
   106  
   107  	// set the freeze value for the process
   108  	Freezer FreezerState `json:"freezer"`
   109  
   110  	// Hugetlb limit (in bytes)
   111  	HugetlbLimit []*HugepageLimit `json:"hugetlb_limit"`
   112  
   113  	// Whether to disable OOM Killer
   114  	OomKillDisable bool `json:"oom_kill_disable"`
   115  
   116  	// Tuning swappiness behaviour per cgroup
   117  	MemorySwappiness *int64 `json:"memory_swappiness"`
   118  
   119  	// Set priority of network traffic for container
   120  	NetPrioIfpriomap []*IfPrioMap `json:"net_prio_ifpriomap"`
   121  
   122  	// Set class identifier for container's network packets
   123  	NetClsClassid uint32 `json:"net_cls_classid_u"`
   124  }