[CRIU] Re: [PATCH cr 09/11] restore: restore content of private mappings before forking children

Andrew Vagin avagin at parallels.com
Mon Oct 15 14:18:34 EDT 2012


On Mon, Oct 15, 2012 at 08:32:34PM +0400, Pavel Emelyanov wrote:
> > +static int restore_anon_vma_content(pid_t pid)
> > +{
> > +	struct vma_area *vma;
> > +	int fd, ret = 0;
> > +
> > +	vma = list_first_entry(&vma_list, struct vma_area, list);
> > +
> > +	fd = open_image_ro(CR_FD_PAGES, pid);
> > +	if (fd < 0)
> > +		return -1;
> > +
> > +	/*
> > +	 * Read page contents.
> > +	 */
> > +	while (1) {
> > +		u64 va;
> > +		char buf[PAGE_SIZE];
> 
> Ugly as sin. Will we fix this thing?
Could you explain why this is ugly?

I'm going to add a fast path, which will compare pfn-s and only
if pfn-s are equal, pages will be compared.

The best way is detect a shared pages during dumping.

Is it answer on your question?
> 
> > +		void *p;
> > +
> 


More information about the CRIU mailing list