Tim Zhang
f34225411e
Remove Box wrap of Cgroup.hire
...
It's unnecessary.
Signed-off-by: Tim Zhang <tim@hyper.sh >
2020-12-17 17:56:46 +08:00
Tim Zhang
cd998f3f9b
Do not place cgroup under relative path read from cgroup by default
...
Add new_with_corresponding_relative_paths to do the original action.
Signed-off-by: Tim Zhang <tim@hyper.sh >
2020-12-17 17:56:46 +08:00
Tim Zhang
1ac76b69ba
Make function find_v1_mount pub
...
The function find_v1_mount is useful for customized impl for Hierarchy.
Signed-off-by: Tim Zhang <tim@hyper.sh >
2020-12-17 17:56:46 +08:00
Tim Zhang
121f78d8e8
Expose deletion error
...
So that users can retry or do some aftercare.
Fixes : #18
Signed-off-by: Tim Zhang <tim@hyper.sh >
2020-12-17 17:56:46 +08:00
Tim Zhang
0f76570677
Avoid exception caused by cgroup writeback feature
...
The cgroup writeback feature requires cooperation
between memcgs and blkcgs.
To avoid exceptions, we should add_task for blkcg before
memcg(push BlkIo before Mem).
For more Information:
https://www.alibabacloud.com/help/doc-detail/155509.ht
Signed-off-by: Tim Zhang <tim@hyper.sh >
2020-12-17 17:56:46 +08:00
Tim Zhang
10650e2b16
Update tests to adapt new type of fields in resource
...
The type has been changed to Option type.
Signed-off-by: Tim Zhang <tim@hyper.sh >
2020-12-17 17:56:46 +08:00
Tim Zhang
567cdb43b3
Use Option as resource fields, remove the update switch: update_values
...
Use idiomatic Option::None to represent optional fields.
This enables updates where not all fields need to be specified.
Signed-off-by: Tim Zhang <tim@hyper.sh >
2020-12-17 17:56:41 +08:00
Tim Zhang
0c18b0855e
Support customized attributes for CpuController and MemController
...
Customized attributes are useful for customized kernels.
Usage:
let resource = &mut cgroups::Resources::default();
resource.cpu.attrs.insert("cpu.cfs_init_buffer_us", "10".to_string());
// apply here
Signed-off-by: Tim Zhang <tim@hyper.sh >
2020-12-17 16:45:41 +08:00
Yang, Wei
ca610bb57e
add add_task_by_tgid
...
Add task by writing thread group id to cgroup.procs.
Signed-off-by: Yang, Wei <wei.yang1@linux.alibaba.com >
Signed-off-by: Tim Zhang <tim@hyper.sh >
2020-12-17 15:57:22 +08:00
Fupan Li
af6fc63bed
Merge pull request #17 from Tim-Zhang/minor-updates
...
Minor updates
2020-10-30 10:15:05 +08:00
Tim Zhang
6f9e89572e
MemController: add method reset_max_usage
...
We need a method to reset the max memory usage recorded.
Signed-off-by: Tim Zhang <tim@hyper.sh >
2020-10-29 19:35:39 +08:00
Tim Zhang
42eb32765b
Make methods to_controller and controller_name of Subsystem public
...
We need these functions to detect whether subsystem path exists.
Signed-off-by: Tim Zhang <tim@hyper.sh >
2020-10-29 19:32:55 +08:00
Tim Zhang
efb98108fc
Fix warnings
...
Got:
cargo build --target x86_64-unknown-linux-musl
Compiling cgroups v0.1.1-alpha.0 (/home/tim/project/cgroups-rs)
warning: unused import: `nix::sys::statfs`
--> src/hierarchies.rs:220:5
|
220 | use nix::sys::statfs;
| ^^^^^^^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
warning: 1 warning emitted
Signed-off-by: Tim Zhang <tim@hyper.sh >
2020-10-29 19:31:55 +08:00
James O. D. Hunt
c310b30c52
Merge pull request #14 from liubin/enhancement/13-fix-warnings
...
fix build warnings
2020-10-01 17:28:16 +01:00
bin liu
152af17f8f
fix build warnings
...
And in Travis CI, treat warnings as error
to keep from merging codes with warning.
Fixes : #13
Signed-off-by: bin liu <bin@hyper.sh >
2020-09-23 16:19:51 +08:00
Bin Liu
d18b3bac2f
Merge pull request #16 from liubin/enhancement/15-add-workflow-checks
...
add basic GitHub workflow for basic checks
2020-09-23 16:17:33 +08:00
bin liu
414fa281cc
add basic github workflow for basic checks
...
Basic checks includes:
- Must have commit title/body
- Must have DCO(SoC)
- Title/Body line length are limited 75/72
- Add wip/do-not-merge to label PRs that could be merged
Fixes : #15
Signed-off-by: bin liu <bin@hyper.sh >
2020-09-23 16:15:08 +08:00
Peng Tao
f0eac7859a
Merge pull request #12 from liubin/fix/11-add-trivas
...
update Travis configs
2020-09-23 14:01:37 +08:00
bin liu
db40fe8cd3
update Travis configs
...
Fixes : #11
Signed-off-by: bin liu <bin@hyper.sh >
2020-09-22 20:39:18 +08:00
Fupan Li
8717524f2c
Merge pull request #10 from Kvasscn/fix-type-i8-compile-error-in-aarch64
...
lib: fix compiling error for type i8 in aarch64 environment
2020-09-22 10:36:14 +08:00
zhanghj
cd7e737149
lib: fix compiling error for type i8 in aarch64 environment
...
c_char is equal to i8 on x86, but it is equal to u8 on arm arch,
so we need to use type c_char instead of i8 to avoid compiling error.
Fixes : #9
Signed-off-by: zhanghj <zhanghj.lc@inspur.com >
2020-09-21 05:40:57 -04:00
Peng Tao
3852d7c180
Merge pull request #8 from liubin/fix/7-add-sync-marker-to-error-cause
...
errors: add sync marker to error cause
0.1.1
2020-09-14 16:15:12 +08:00
Peng Tao
0aaf7dba0b
Merge pull request #6 from liubin/fix/cfs_quota-to-i64
...
cpu: change cfs_quota from u64 to i64
2020-09-14 16:14:22 +08:00
bin liu
42685bbfe9
errors: add sync marker to error cause
...
Errors cause should be shared to let anyhow to wrap it.
Fixes : #7
Signed-off-by: bin liu <bin@hyper.sh >
2020-09-14 15:22:55 +08:00
bin liu
f8d653e987
cpu: change cfs_quota from u64 to i64
...
cfs_quota can be set to -1 to indicate no limit
Fixes : #5
Signed-off-by: bin liu <bin@hyper.sh >
2020-09-14 13:00:43 +08:00
Peng Tao
d20e6a5383
Merge pull request #4 from liubin/master
...
add cgroup v2 support
2020-09-09 20:44:28 +08:00
bin liu
be617190c7
hugetlb: update test to avoid depending on test env
...
Signed-off-by: bin liu <bin@hyper.sh >
2020-09-09 17:09:12 +08:00
bin liu
250ada183a
cargo fmt
...
Signed-off-by: bin liu <bin@hyper.sh >
2020-09-09 16:42:55 +08:00
bin liu
ff6a0ea82a
add SPDX-License-Identifier for modified files
...
Signed-off-by: bin liu <bin@hyper.sh >
2020-09-09 13:35:46 +08:00
bin liu
bcbf438823
Merge remote-tracking branch 'upstream/master'
2020-09-09 13:27:12 +08:00
bin liu
c3912223d0
use let Some() instead of is_some() to make codes clear
...
Signed-off-by: bin liu <bin@hyper.sh >
2020-09-09 13:26:18 +08:00
bin liu
5d51e50bec
get relative paths at new/load func default.
...
Signed-off-by: bin liu <bin@hyper.sh >
2020-09-08 10:30:29 +08:00
Peng Tao
a1bc5868d6
Merge pull request #3 from liubin/fix/2
...
add SPDX-License-Identifier for all source
2020-09-08 09:16:47 +08:00
bin liu
86b245076c
add SPDX-License-Identifier for all source
...
Add SPDX-License-Identifier for all existing codes.
Fixes : #2
Signed-off-by: bin liu <bin@hyper.sh >
2020-09-07 20:29:40 +08:00
bin liu
cd2c748a74
add systemd controller; add more tests; update blkio stat for v2
...
Signed-off-by: bin liu <bin@hyper.sh >
2020-09-07 14:18:41 +08:00
bin liu
c623dc3fba
add basic v2 cpu/memory functions
...
Signed-off-by: bin liu <bin@hyper.sh >
2020-09-02 22:03:11 +08:00
bin liu
704db324ae
fix: create all dirs
...
Signed-off-by: bin liu <bin@hyper.sh >
2020-09-01 00:01:28 +08:00
bin liu
9fe6cb58e4
change *limit* in memory from u64 to i64
...
Signed-off-by: bin liu <bin@hyper.sh >
2020-08-27 23:06:44 +08:00
bin liu
c702852fd7
add disable oom_control function
...
Signed-off-by: bin liu <bin@hyper.sh >
2020-08-25 11:35:01 +08:00
bin liu
9d70467327
add hugetlb functions
...
Signed-off-by: bin liu <bin@hyper.sh >
2020-08-25 10:58:56 +08:00
bin liu
6b1b26b1fe
copy cpuset after created
...
Signed-off-by: bin liu <bin@hyper.sh >
2020-08-25 10:51:29 +08:00
bin liu
9ce206f6bc
probe cgroup v1 mount path
...
Signed-off-by: bin liu <bin@hyper.sh >
2020-08-25 10:50:52 +08:00
Levente Kurusa
ed1e8162d5
rust2018: remove extern crate
...
Signed-off-by: Levente Kurusa <lkurusa@acm.org >
2018-12-23 16:57:41 +01:00
Levente Kurusa
932a6e770f
Cargo: bump Rust version to 2018
...
Signed-off-by: Levente Kurusa <lkurusa@acm.org >
2018-12-23 16:32:00 +01:00
Levente Kurusa
01a3c22829
Transition to Rust 2018
...
Signed-off-by: Levente Kurusa <lkurusa@acm.org >
2018-12-23 16:31:05 +01:00
Levente Kurusa
b5e0706d6a
(cargo-release) start next development iteration 0.1.1-alpha.0
v0.1.0
2018-12-23 16:24:51 +01:00
Levente Kurusa
8a2fa92c3a
Update README
...
Signed-off-by: Levente Kurusa <lkurusa@acm.org >
0.1.0
2018-11-20 15:11:22 +02:00
Sam Wilson
dd621eae4e
Replace &String with &str
2018-10-30 21:52:31 +01:00
Sam Wilson
751dbc7244
Replace some &String with &Path
2018-10-30 21:51:50 +01:00
Sam Wilson
3413b7d847
Expose the path of controllers for chown
2018-10-30 21:51:50 +01:00