-
Notifications
You must be signed in to change notification settings - Fork 105
Add cgroup v2 support #133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
@vingu-linaro if you have time, plz review this pr. thanks |
74e7474 to
909b59e
Compare
beab893 to
0f0a372
Compare
|
In summary, I should only enable the threaded mode on the target cgroup type(like Werkov said that I also need to check the domain in other controllers) and write the tid to the cgroup.procs? Thanks @vingu-linaro @Werkov |
a14cfc8 to
8edf7b4
Compare
Werkov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your code seem to work in some situations (single threaded processes) but could be broken in some other (noted in a comment). There may be no tests in rt-app that would capture this so it may only become visible when used by more users :)
Signed-off-by: Wenyu Huang <huangwenyuu@outlook.com>
Werkov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could work.
Added some stylistic/resource tracking remarks.
|
|
||
| file = strcmp(name, "/") ? "/tasks" : "tasks"; | ||
| if (ctrl.version == 1) { | ||
| file = strcmp(name, "/") ? "/tasks" : "tasks"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder it this special casing for root cgrp is worth it (here and other places).
-sprintf(path, "%s%s%s", ctrl.mount_point, name, file);
+sprintf(path, "%s%s/%s", ctrl.mount_point, name, file);with possibly double // being resolved by open.
| if (fclose(tasks)) { | ||
| perror("fclose"); | ||
| goto error; | ||
| if (ctrl.version == 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
v2 file deserves to be closed here too, no?
| goto error; | ||
| } | ||
| if (fprintf(cgroup_file, "threaded") < 0) { | ||
| perror("fprintf"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cgroup_file not closed here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also some better message may ease future debugging, like cgroup.type <- threaded failed.
In cgroup v2, there is no /sys/fs/cgroup/cpu directory. All groups are mounted on /sys/fs/cgroup. And if we would like to open child's group's cpu subsystems, we need to "echo "+cpu" > cgroup.subtree_control" in the parent group.