[CRIU] [PATCH] pidns: Optimize set_next_pid()

Andrei Vagin avagin at virtuozzo.com
Fri May 12 13:59:12 PDT 2017


Applied, thanks

On Wed, May 10, 2017 at 05:26:27PM +0300, Kirill Tkhai wrote:
> 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 at virtuozzo.com>
> ---
>  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 3481362b6..073a61983 100644
> --- a/criu/cr-restore.c
> +++ b/criu/cr-restore.c
> @@ -402,7 +402,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));
> 


More information about the CRIU mailing list