From dfc97293e0a5cc4b6c76f6616ec6fe0d0c80b7da Mon Sep 17 00:00:00 2001 From: Kirill Tkhai Date: Wed, 10 May 2017 17:26:27 +0300 Subject: [PATCH] pidns: Optimize set_next_pid() Do not use pid namespace helper when there is one-level pid. If it's one-level, then the created task is in root pid ns. Also, as a parent's level is less or equal a child's, then parent is in root pid ns too. So, write next pid directly. Signed-off-by: Kirill Tkhai Signed-off-by: Andrei Vagin --- criu/cr-restore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/criu/cr-restore.c b/criu/cr-restore.c index 008183fb8..30559bc37 100644 --- a/criu/cr-restore.c +++ b/criu/cr-restore.c @@ -406,7 +406,7 @@ static int set_next_pid(struct ns_id *pid_ns, struct pid *pid) { int i, sk, level = pid->level; - if (!(root_ns_mask & CLONE_NEWPID)) { + if (!(root_ns_mask & CLONE_NEWPID) || level == 1) { if (last_level_pid(pid) == INIT_PID) return 0; return __set_next_pid(last_level_pid(pid));