-
Notifications
You must be signed in to change notification settings - Fork 346
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
Implement the container_clone using CLONE_PARENT #1610
Conversation
3472f34
to
5efe55a
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #1610 +/- ##
==========================================
+ Coverage 68.84% 68.98% +0.13%
==========================================
Files 120 120
Lines 13072 13171 +99
==========================================
+ Hits 9000 9086 +86
- Misses 4072 4085 +13 |
Good point. Let me take a look tomorrow. |
@utam0k I looked into I don't have a strong preference. If you don't have a strong preference, I would recommend us to stay with |
Plus, I am hitting EINVAL with specifying both CLONE_PARENT and exit signal (SIGCHLD) with |
Aha, following this thread: checkpoint-restore/criu#926 It looks like we should not pass in exit signal when CLONE_PARENT is used. There is more context in the referenced thread. |
Updated 68511cf with |
I am in favor of using clone3. We have decided that we will support kernels >= 5.4 only and clone3 has been available since kernel 5.3 so we should not need a fallback. |
Sounds good. I updated the comments with what has been discussed above. PTAL. Thanks. |
18e69d0
to
fd9ebc5
Compare
💯 Since they are too new, there are some options we have to be careful to use. |
let mut pidfd = -1; | ||
clone.flag_pidfd(&mut pidfd).exit_signal(SIGCHLD as u64); |
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.
Do you have the plan to use pidfd?
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 see a need for this, so I can remove them for now, until we need it.
Can you test what the performance impact of this change is? |
With this PR.
Without the PR:
I believe the result matches the theoretical assumption that the performance different should be minimal since the underlying syscall is the same. The average with clone3 seems to be a little slower (about 1 ms) difference, but this should be within the standard deviation. |
Signed-off-by: Eric Fang <yihuaf@unkies.org>
Thanks, @yihuaf |
This is the first step into fixing #1601 which implements a
container_clone
call that uses clone andCLONE_PARENT
. Since this function usesCLONE_PARENT
which creates sibling process instead of child process, we need to re-examine the overall logic to make sure all thewaitpid
calls are still correct, since a process can only wait on its immediate child process.