-
Notifications
You must be signed in to change notification settings - Fork 611
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
Restore a thread to a correct v1 cgroup #2347
Restore a thread to a correct v1 cgroup #2347
Conversation
4b996f1
to
453f0a9
Compare
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 wasn't aware that cgroup-v1 supports thread granularity when implementing the threaded controller support. Thanks for your PR, the PR looks good to me, I just leave some minor comments.
453f0a9
to
7f221a9
Compare
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 don't like the copy-pasting of the test helper code, but I guess cleaning that up is not in scope for this change. The added logic looks ok.
7f221a9
to
32b2cae
Compare
Currently we have checkpoint/restore support only of cgroup v2 threaded controllers. Threads originating in cgroup v1 environments will be restored to the main thread's cgroup. This change extends the support for a cgroups v1. Signed-off-by: Stepan Pieshkin <[email protected]>
Co-developed-by: Stepan Pieshkin <[email protected]> Signed-off-by: Stepan Pieshkin <[email protected]> Signed-off-by: Michal Clapinski <[email protected]>
32b2cae
to
48c95f6
Compare
#include <pthread.h> | ||
#include "zdtmtst.h" | ||
|
||
const char *test_doc = "Check that cgroup layout of threads is preserved"; |
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.
Note: clang-format is complaining about alignment here. s/\t/ /
here and below.
|
||
int p1[2], pr[2]; | ||
|
||
void *child(void *args) |
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.
Misleading name for a thread, don't you think?
* then it reports the restore status (int). | ||
*/ | ||
|
||
pipe(p1); |
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.
pls handler errors here and in other places.
|
||
if (mkdir(dirname, 0700) < 0) { | ||
pr_perror("Can't make dir"); | ||
goto out; |
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.
it has to exit with a non-zero code in this case.
Currently we have checkpoint/restore support only of cgroup v2 threaded controllers. Threads originating in cgroup v1 environments will be restored to the main thread's cgroup. This change extends the support for a cgroups v1.