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

Cyrill Gorcunov gorcunov at openvz.org
Wed May 15 09:53:28 EDT 2013


On Wed, May 15, 2013 at 05:34:12PM +0400, Pavel Emelyanov wrote:
> >> 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.

Unified approach. All threads (and thread leader) do have own stacks
allocated in structure. You don't have to remember where stacks live
or if there something special with stacks (leader stack is static and
threads stacks are dynamic, this is pretty inconvenient to deal with,
instead we allocate each thread own stack, that simple).

+static int noinline parasite_daemon(struct parasite_init_args *args)
+{
	...
+	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);
+	else
+		call_daemon_thread(new_sp, args, s, __parasite_daemon_thread);

I don't have to calculate the stack address for leader in special way, it's
unified.


More information about the CRIU mailing list