[CRIU] [PATCH] parasite: send PARASITE_CMD_FINI before resuming the target process

Andrew Vagin avagin at parallels.com
Tue Sep 16 12:50:39 PDT 2014


On Tue, Sep 16, 2014 at 10:59:25PM +0400, Pavel Emelyanov wrote:
> On 09/16/2014 10:39 PM, Andrey Vagin wrote:
> > The control socket has enough buffer for one command and the target
> > process will not wait a new command, so we will avoid extra context
> > switches.
> 
> Can you describe exactly what will change after that? Will parasite
> perform one more syscall w/o step-by-step? Or what?

Now we executes the parasite and it checks the control socket, sees
nothing and goes to sleep before the next command.

Then we send a command, the kernel wakes up the parasite and it starts to
execute this command.

After this patch the parasite will have a command immediately
after resuming.

Actually all this would be true, if we didn't use PTRACE_SYSCALL:(. Now
parasite stops on the enter point into the recv syscall. So currently
this patch changes nothing good or wrong.

> 
> > Signed-off-by: Andrey Vagin <avagin at openvz.org>
> > ---
> >  parasite-syscall.c | 10 +++++-----
> >  1 file changed, 5 insertions(+), 5 deletions(-)
> > 
> > diff --git a/parasite-syscall.c b/parasite-syscall.c
> > index 6f56617..354f0e9 100644
> > --- a/parasite-syscall.c
> > +++ b/parasite-syscall.c
> > @@ -863,17 +863,17 @@ static int parasite_fini_seized(struct parasite_ctl *ctl)
> >  		return -1;
> >  	}
> >  
> > +	ret = __parasite_execute_daemon(PARASITE_CMD_FINI, ctl);
> > +	close_safe(&ctl->tsock);
> > +	if (ret)
> > +		return -1;
> > +
> >  	ret = ptrace(PTRACE_SYSCALL, pid, NULL, NULL);
> >  	if (ret) {
> >  		pr_perror("ptrace");
> >  		return -1;
> >  	}
> >  
> > -	ret = __parasite_execute_daemon(PARASITE_CMD_FINI, ctl);
> > -	close_safe(&ctl->tsock);
> > -	if (ret)
> > -		return -1;
> > -
> >  	if (parasite_stop_on_syscall(1, __NR_rt_sigreturn))
> >  		return -1;
> >  
> > 
> 


More information about the CRIU mailing list