[CRIU] [PATCH 10/22] parasite: Switch parasite to daemon mode
Pavel Emelyanov
xemul at parallels.com
Wed May 15 09:34:12 EDT 2013
On 05/15/2013 05:10 PM, Cyrill Gorcunov wrote:
> 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.
Still don't understand why.
> The static stack is
> for paraite trap mode only. Each daemon have own stack not intersected or shared
> with anything else.
Sub threads should use own stacks, this is OK.
> .
>
More information about the CRIU
mailing list