Commit b30f0f01 authored by Pavel's avatar Pavel Committed by Pavel Emelyanov

ns: Dump namespaces in parallel

The main reason for this is -- dumping namespace has a lot of
points when the process just waits for something. At the same
time criu process wait for the ns dumper and doesn't dump
others.

The great example of waiting for something is setns syscall.
Very often it calls synchronize_rcu() which can be quite long.
Let other processes do smth useful while this.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
Acked-by: 's avatarAndrew Vagin <avagin@parallels.com>
parent bbe3f941
......@@ -459,7 +459,7 @@ int dump_namespaces(struct pstree_item *item, unsigned int ns_flags)
{
struct pid *ns_pid = &item->pid;
struct ns_id *ns;
int pid, status;
int pid, nr = 0;
int ret = 0;
/*
......@@ -496,8 +496,14 @@ int dump_namespaces(struct pstree_item *item, unsigned int ns_flags)
exit(ret);
}
ret = waitpid(pid, &status, 0);
if (ret != pid) {
nr++;
}
while (nr > 0) {
int status;
ret = waitpid(-1, &status, 0);
if (ret < 0) {
pr_perror("Can't wait ns dumper");
return -1;
}
......@@ -506,6 +512,8 @@ int dump_namespaces(struct pstree_item *item, unsigned int ns_flags)
pr_err("Namespaces dumping finished with error %d\n", status);
return -1;
}
nr--;
}
pr_info("Namespaces dump complete\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment