Skip to content

cgroup overhaul#46

Open
BarryLhm wants to merge 1 commit intoRuriOSS:mainfrom
BarryLhm:cgroup
Open

cgroup overhaul#46
BarryLhm wants to merge 1 commit intoRuriOSS:mainfrom
BarryLhm:cgroup

Conversation

@BarryLhm
Copy link

@BarryLhm BarryLhm commented Jan 6, 2026

This closes #45.
I'm inexperienced in programming,
so please do ensure all changes are tested to work correctly before merging!!!

@BarryLhm BarryLhm changed the title [placeholder] add kill with cgroupv2 cgroup overhaul Jan 8, 2026
@BarryLhm BarryLhm force-pushed the cgroup branch 2 times, most recently from 170a8f9 to 5c9316d Compare January 14, 2026 16:48
@BarryLhm BarryLhm force-pushed the cgroup branch 5 times, most recently from e60db7d to 7b9f215 Compare January 20, 2026 04:18
@BarryLhm BarryLhm force-pushed the cgroup branch 3 times, most recently from edf17df to eb9e0aa Compare February 11, 2026 06:25
@BarryLhm BarryLhm marked this pull request as ready for review February 11, 2026 06:26
@Moe-hacker
Copy link
Member

Should we add the file w to .gitignore, or give it a clear name?

1 similar comment
@Moe-hacker
Copy link
Member

Should we add the file w to .gitignore, or give it a clear name?

@BarryLhm
Copy link
Author

BarryLhm commented Feb 13, 2026

I haven't come up with a clear name.
"w" is for "wrapper" like in "gradlew" or "wand"
what about "r" or "rr"? 🤔
or a formal long name?

@Moe-hacker
Copy link
Member

Maybe we can use make/just command instead it.

@Moe-hacker
Copy link
Member

On debian 13 aarch64, clang got error like

../src/cgroup.c:57:33: error: use of undeclared identifier 'LONG_MAX'                                          57 |                 case 'g': case 'G': if (ret > SSIZE_MAX / 1024 / 1024 / 1024) return -2; ret *= 1024 * 1024 * 1024; break;                                      |                                               ^                                                     /usr/include/aarch64-linux-gnu/bits/posix1_lim.h:169:21: note: expanded from macro 'SSIZE_MAX'                169 | #  define SSIZE_MAX     LONG_MAX                    |                         ^

So we need a #include <limits.h>

@Moe-hacker
Copy link
Member

If we re-run the container, seems that cgroup limit will not work properly, did you enforced to attach the process to correct cgroup?

@BarryLhm
Copy link
Author

BarryLhm commented Feb 13, 2026

On debian 13 aarch64, clang got error like

../src/cgroup.c:57:33: error: use of undeclared identifier 'LONG_MAX'                                          57 |                 case 'g': case 'G': if (ret > SSIZE_MAX / 1024 / 1024 / 1024) return -2; ret *= 1024 * 1024 * 1024; break;                                      |                                               ^                                                     /usr/include/aarch64-linux-gnu/bits/posix1_lim.h:169:21: note: expanded from macro 'SSIZE_MAX'                169 | #  define SSIZE_MAX     LONG_MAX                    |                         ^

So we need a #include <limits.h>

iirc i added it, let me check..

maybe it disappeared after a checkout
fixed

@BarryLhm
Copy link
Author

If we re-run the container, seems that cgroup limit will not work properly, did you enforced to attach the process to correct cgroup?

the original logic is not changed, which means i have to find the bug.

changelog:

Functional:
- (BREAKING) Change container cgroup dir
- Fix cgroup v1 controller test dir not freed after use
- Deduplicate cgroup v1/v2 mount/attach/set code
- Add cgroup v2 attach/kill support (experimental)

CMake:
- Allow project to build on Android with CMake

Misc adjustments:
- add wrapper script (./w) for quick formatting

Non-functional:
- formatted all source files
@BarryLhm
Copy link
Author

Maybe we can use make/just command instead it.

they are hard to pass arguments to

@BarryLhm
Copy link
Author

Maybe we can use make/just command instead it.

removed after i found make format

@Moe-hacker
Copy link
Member

Cgroup limit should only be set once when init the container, after that, even no limitations set, we still need to attach process to the existing cgroup.

And for unshare container, maybe we should setup a new cgroup on host before unshare(), so that we can just use cgroupfs on host to kill it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

container cgroup isolation?

2 participants