[CRIU] [PATCH 02/10] uffdd: Read pages directly into destination buffer

Mike Rapoport rppt at linux.vnet.ibm.com
Sat Nov 12 05:40:33 PST 2016


On Sat, Nov 12, 2016 at 08:23:46AM +0300, Pavel Emelyanov wrote:
> This avoids excessive memcpy() one instruction below.
> 
> Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>

Acked-by: Mike Rapoport <rppt at linux.vnet.ibm.com>

> ---
>  criu/uffd.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/criu/uffd.c b/criu/uffd.c
> index 3472e7d..4ee37fa 100644
> --- a/criu/uffd.c
> +++ b/criu/uffd.c
> @@ -381,7 +381,6 @@ out:
>  static int get_page(struct lazy_pages_info *lpi, unsigned long addr, void *dest)
>  {
>  	int ret;
> -	unsigned char buf[PAGE_SIZE];
> 
>  	lpi->pr.reset(&lpi->pr);
> 
> @@ -393,13 +392,11 @@ static int get_page(struct lazy_pages_info *lpi, unsigned long addr, void *dest)
>  	if (pagemap_zero(lpi->pr.pe))
>  		return 0;
> 
> -	ret = lpi->pr.read_pages(&lpi->pr, addr, 1, buf);
> +	ret = lpi->pr.read_pages(&lpi->pr, addr, 1, dest);
>  	pr_debug("read_pages ret %d\n", ret);
>  	if (ret <= 0)
>  		return ret;
> 
> -	memcpy(dest, buf, PAGE_SIZE);
> -
>  	return 1;
>  }
> 
> -- 
> 2.5.0
> 
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu
> 



More information about the CRIU mailing list