Fork Vasum on GitHub Official Vasum Wiki on Tizen.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
cgroups-config.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Contact: Dariusz Michaluk <d.michaluk@samsung.com>
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License
17  */
18 
25 #ifndef CGROUPS_CONFIG_HPP
26 #define CGROUPS_CONFIG_HPP
27 
28 #include "config.hpp"
29 #include "cargo/fields.hpp"
30 
31 #include <string>
32 #include <vector>
33 
34 namespace vasum {
35 
37 
41  uint64_t limit;
42 
46  uint64_t reservation;
47 
51  uint64_t swap;
52 
56  uint64_t kernel;
57 
61  uint64_t swappiness;
62 
64  (
65  limit,
67  swap,
68  kernel,
70  )
71 };
72 
74 
78  uint64_t shares;
79 
85  uint64_t quota;
86 
92  uint64_t period;
93 
98  uint64_t realtimeRuntime;
99 
103  uint64_t realtimePeriod;
104 
108  std::string cpus;
109 
113  std::string mems;
114 
116  (
117  shares,
118  quota,
119  period,
122  cpus,
123  mems
124  )
125 };
126 
128 
132  int64_t limit;
133 
135  (
136  limit
137  )
138 };
139 
140 struct WeightDevice {
141 
145  int64_t major;
146  int64_t minor;
147 
151  uint16_t weight;
152 
157  uint16_t leafWeight;
158 
160  (
161  major,
162  minor,
163  weight,
164  leafWeight
165  )
166 };
167 
169 
173  int64_t major;
174  int64_t minor;
175 
179  uint64_t rate;
180 
182  (
183  major,
184  minor,
185  rate
186  )
187 };
188 
190 
195  uint16_t blkioWeight;
196 
202  uint16_t blkioLeafWeight;
203 
207  std::vector<WeightDevice> blkioWeightDevice;
208 
212  std::vector<ThrottleDevice> blkioThrottleWriteBpsDevice;
213  std::vector<ThrottleDevice> blkioThrottleReadBpsDevice;
214  std::vector<ThrottleDevice> blkioThrottleWriteIOPSDevice;
215  std::vector<ThrottleDevice> blkioThrottleReadIOPSDevice;
216 
218  (
219  blkioWeight,
226  )
227 };
228 
230 
234  std::string pageSize;
235 
239  uint64_t limit;
240 
242  (
243  pageSize,
244  limit
245  )
246 };
247 
248 typedef std::vector<HugePageLimit> CGroupHugePageLimitsConfig;
249 
250 struct Priority {
251 
255  std::string name;
256 
260  uint32_t priority;
261 
263  (
264  name,
265  priority
266  )
267 };
268 
270 
274  std::string classID;
275 
279  std::vector<Priority> priorities;
280 
282  (
283  classID,
284  priorities
285  )
286 };
287 
288 } // namespace vasum
289 
290 
291 #endif // CGROUPS_CONFIG_HPP
std::vector< WeightDevice > blkioWeightDevice
Specifies the list of devices which will be bandwidth rate limited.
Definition: cgroups-config.hpp:207
uint16_t blkioLeafWeight
Equivalents of blkioWeight for the purpose of deciding how much weight tasks in the given cgroup has ...
Definition: cgroups-config.hpp:202
uint16_t blkioWeight
This is default weight of the group on all devices until and unless overridden by per-device rules...
Definition: cgroups-config.hpp:195
std::string classID
class identifier for container's network packets
Definition: cgroups-config.hpp:274
uint64_t realtimePeriod
same as period but applies to realtime scheduler only
Definition: cgroups-config.hpp:103
std::string mems
list of Memory Nodes the container will run in
Definition: cgroups-config.hpp:113
Definition: cgroups-config.hpp:168
uint64_t kernel
Kernel memory limit (in bytes)
Definition: cgroups-config.hpp:56
std::vector< Priority > priorities
priorities of network traffic for container
Definition: cgroups-config.hpp:279
int64_t major
major, minor numbers for device
Definition: cgroups-config.hpp:145
uint64_t limit
Memory limit (in bytes)
Definition: cgroups-config.hpp:41
uint16_t weight
bandwidth rate for the device, range is from 10 to 1000
Definition: cgroups-config.hpp:151
uint64_t swap
Total memory usage (memory + swap); set `-1' to disable swap.
Definition: cgroups-config.hpp:51
int64_t major
major, minor numbers for device
Definition: cgroups-config.hpp:173
Definition: cgroups-config.hpp:269
Definition: cgroups-config.hpp:229
Configuration file for the code.
Definition: cgroups-config.hpp:140
std::vector< ThrottleDevice > blkioThrottleWriteBpsDevice
Specify the list of devices which will be IO rate limited.
Definition: cgroups-config.hpp:212
std::vector< HugePageLimit > CGroupHugePageLimitsConfig
Definition: cgroups-config.hpp:248
Definition: cgroups-config.hpp:189
std::string name
interface name
Definition: cgroups-config.hpp:255
Definition: cgroups-config.hpp:127
Definition: cgroups-config.hpp:36
#define CARGO_REGISTER(...)
Registers cargo fields within class.
Definition: fields.hpp:74
std::vector< ThrottleDevice > blkioThrottleWriteIOPSDevice
Definition: cgroups-config.hpp:214
uint64_t period
specifies a period of time in microseconds for how regularly a cgroup's access to CPU resources shoul...
Definition: cgroups-config.hpp:92
uint64_t limit
limit in bytes of hugepagesize HugeTLB usage
Definition: cgroups-config.hpp:239
uint16_t leafWeight
bandwidth rate for the device while competing with the cgroup's child cgroups range is from 10 to 100...
Definition: cgroups-config.hpp:157
int64_t minor
Definition: cgroups-config.hpp:174
uint64_t swappiness
Tuning swappiness behaviour per cgroup.
Definition: cgroups-config.hpp:61
std::vector< ThrottleDevice > blkioThrottleReadBpsDevice
Definition: cgroups-config.hpp:213
int64_t minor
Definition: cgroups-config.hpp:146
std::string cpus
list of CPUs the container will run in
Definition: cgroups-config.hpp:108
std::vector< ThrottleDevice > blkioThrottleReadIOPSDevice
Definition: cgroups-config.hpp:215
uint64_t shares
specifies a relative share of CPU time available to the tasks in a cgroup
Definition: cgroups-config.hpp:78
uint32_t priority
priority applied to the interface
Definition: cgroups-config.hpp:260
Definition: cgroups-config.hpp:250
Definition: cgroups-config.hpp:73
uint64_t realtimeRuntime
specifies a period of time in microseconds for the longest continuous period in which the tasks in a ...
Definition: cgroups-config.hpp:98
uint64_t rate
IO rate limit for the device.
Definition: cgroups-config.hpp:179
uint64_t quota
specifies the total amount of time in microseconds for which all tasks in a cgroup can run during one...
Definition: cgroups-config.hpp:85
uint64_t reservation
Memory reservation or soft_limit (in bytes)
Definition: cgroups-config.hpp:46
std::string pageSize
hugepage size
Definition: cgroups-config.hpp:234
int64_t limit
specifies the maximum number of tasks in the cgroup
Definition: cgroups-config.hpp:132