[CRIU] [PATCH 10/22] parasite: Switch parasite to daemon mode

Cyrill Gorcunov gorcunov at openvz.org
Wed May 15 09:10:32 EDT 2013


On Wed, May 15, 2013 at 05:03:31PM +0400, Pavel Emelyanov wrote:
> > +static int noinline parasite_daemon(struct parasite_init_args *args)
> > +{
> > +	struct tid_state_s *s;
> > +	unsigned long new_sp = 0;
> > +	bool is_leader = false;
> > +
> > +	s = find_thread_state(args->real);
> > +	if (!s)
> > +		return -ENOENT;
> > +
> > +	if (s->real == thread_leader->real)
> > +		is_leader = true;
> > +
> > +	pr_info("Parasite entering daemon mode for %d\n", s->real);
> > +	new_sp = (unsigned long)(void *)&s->stack[PARASITE_STACK_SIZE - 8];
> > +
> > +	if (is_leader)
> > +		call_daemon_thread(new_sp, args, s, __parasite_daemon_thread_leader);
> 
> Why does leader need yet another stack?

Because it spins in memory, even when this call complete, so better to not use
the static stack allocated in parasite blob for that. The static stack is
for paraite trap mode only. Each daemon have own stack not intersected or shared
with anything else.


More information about the CRIU mailing list