[CRIU] [RFC 3/3] Probe for task size in restorer

Cyrill Gorcunov gorcunov at gmail.com
Fri Jul 24 01:06:42 PDT 2015


On Thu, Jul 23, 2015 at 07:59:50AM -0400, Christopher Covington wrote:
> @@ -772,10 +772,18 @@ static int unmap_old_vmas(void *premmapped_addr, unsigned long premmapped_len,
>  		return -1;
>  	}
>  
> -	ret = sys_munmap(p2 + s2, (void *) TASK_SIZE - (p2 + s2));
> +	/* TODO: Use args->mm_saved_aux to get page size */
> +	for (task_size = TASK_SIZE_MIN; task_size < TASK_SIZE_MAX; task_size <<= 1)
> +		if (sys_munmap((void *)task_size, 65536))
> +			break;
> +
> +	if (TASK_SIZE_MIN != TASK_SIZE_MAX)
> +		pr_info("Found task size of %lx\n", task_size);
> +
> +	ret = sys_munmap(p2 + s2, (void *) task_size - (p2 + s2));
>  	if (ret) {
>  		pr_err("Unable to unmap (%p-%p): %d\n",
> -				p2 + s2, (void *)TASK_SIZE, ret);
> +				p2 + s2, (void *)task_size, ret);
>  		return -1;
>  	}

I don't like such iterations in a general code, may we have
some arch-specific helper to fetch proper task size instead?


More information about the CRIU mailing list