[CRIU] [PATCH] mm: do check on shared pages only if a vma is inherited

Pavel Emelyanov xemul at parallels.com
Tue Aug 13 12:06:47 EDT 2013


On 08/13/2013 07:11 PM, Andrey Vagin wrote:
> Signed-off-by: Andrey Vagin <avagin at openvz.org>
> ---
>  cr-restore.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/cr-restore.c b/cr-restore.c
> index 5c6e4bb..e5fac9f 100644
> --- a/cr-restore.c
> +++ b/cr-restore.c
> @@ -352,7 +352,7 @@ static int restore_priv_vma_content(pid_t pid)
>  			p = decode_pointer((off) * PAGE_SIZE +
>  					vma_premmaped_start(&vma->vma));
>  
> -			if (memcmp(p, buf, PAGE_SIZE) == 0) {
> +			if (vma->ppage_bitmap && memcmp(p, buf, PAGE_SIZE) == 0) {

Please do it more optimal. If we don't to memcmp() we can
restore page contents directly into memory, not in the temporary
intermediate buf, thus avoiding double copy.

>  				nr_shared++;
>  				continue;
>  			}
> 




More information about the CRIU mailing list