2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-29 05:18:00 +00:00

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 <ktkhai@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
This commit is contained in:
Kirill Tkhai 2017-05-10 17:26:27 +03:00 committed by Andrei Vagin
parent 9fd53e95e0
commit dfc97293e0

View File

@ -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));