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.
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.
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.
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.
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.
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.