[CRIU] [RFC PATCH 12/16] criu: lazy-pages: s/get_page/get_pages/

Mike Rapoport rppt at linux.vnet.ibm.com
Wed Oct 5 07:55:57 PDT 2016


On Wed, Oct 05, 2016 at 04:12:51PM +0300, Pavel Emelyanov wrote:
> On 09/27/2016 04:42 PM, Mike Rapoport wrote:
> > Signed-off-by: Mike Rapoport <rppt at linux.vnet.ibm.com>
> > ---
> >  criu/uffd.c | 11 ++++-------
> >  1 file changed, 4 insertions(+), 7 deletions(-)
> > 
> > diff --git a/criu/uffd.c b/criu/uffd.c
> > index 83582d0..4b0fd44 100644
> > --- a/criu/uffd.c
> > +++ b/criu/uffd.c
> > @@ -476,10 +476,9 @@ out:
> >  	return NULL;
> >  }
> >  
> > -static int get_page(struct lazy_pages_info *lpi, unsigned long addr)
> > +static int get_pages(struct lazy_pages_info *lpi, unsigned long addr, int nr)
> >  {
> >  	int ret;
> > -	unsigned char buf[PAGE_SIZE];
> >  
> >  	lpi->pr.reset(&lpi->pr);
> >  
> > @@ -491,14 +490,12 @@ static int get_page(struct lazy_pages_info *lpi, unsigned long addr)
> >  	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, nr, lpi->buf);
> 
> This hunk doesn't fit the subject and seem to belong to patch #10.

I'll fix the subject. The hunk does belong here, the comment should be much
more elaborate
 
> >  	pr_debug("read_pages ret %d\n", ret);
> >  	if (ret <= 0)
> >  		return ret;
> >  
> > -	memcpy(lpi->buf, buf, PAGE_SIZE);
> > -
> > -	return 1;
> > +	return nr;
> >  }
> >  
> >  static int uffd_copy(struct lazy_pages_info *lpi, __u64 address)
> > @@ -509,7 +506,7 @@ static int uffd_copy(struct lazy_pages_info *lpi, __u64 address)
> >  	if (opts.use_page_server)
> >  		rc = get_remote_pages(lpi->pid, address, 1, lpi->buf);
> >  	else
> > -		rc = get_page(lpi, address);
> > +		rc = get_pages(lpi, address, 1);
> >  	if (rc <= 0)
> >  		return rc;
> >  
> > 
> 



More information about the CRIU mailing list