[CRIU] [RFC PATCH] Try to include userfaultfd with criu
Adrian Reber
adrian at lisas.de
Mon Oct 26 12:49:40 PDT 2015
On Mon, Oct 26, 2015 at 07:13:06PM +0300, Pavel Emelyanov wrote:
> On 10/26/2015 03:41 PM, Adrian Reber wrote:
> > Pavel, thanks for the comments on the userfaultfd integration. I am
> > trying to integrate all your suggestions. I have question about
> > restoring pages... Or rather about not restoring pages.
> >
> > My current approach is, if the parameter --lazy-pages is specified, to
> > skip pages with MAP_ANONYMOUS. I thought about skipping the pages in
> > restore_priv_vma_content().
>
> Correct.
>
> > If I skip pages I need to seek with a
> > different value then '0' in read_pagemap_page() to read from the right
> > position from the pages-x.img file.
>
> Yes, there's skip_pagemap_pages() call for that :)
So what do you say to a patch like this:
diff --git a/include/page-read.h b/include/page-read.h
index 9e3013a..e973426 100644
--- a/include/page-read.h
+++ b/include/page-read.h
@@ -51,6 +51,7 @@ struct page_read {
/* stop working on current pagemap */
void (*put_pagemap)(struct page_read *);
void (*close)(struct page_read *);
+ void (*skip_pages)(struct page_read *, unsigned long len);
/* Private data of reader */
struct cr_img *pmi;
diff --git a/page-read.c b/page-read.c
index 832c057..6c0bb95 100644
--- a/page-read.c
+++ b/page-read.c
@@ -279,6 +279,7 @@ int open_page_read_at(int dfd, int pid, struct page_read *pr, int pr_flags)
pr->put_pagemap = put_pagemap;
pr->read_page = read_pagemap_page;
pr->close = close_page_read;
+ pr->skip_pages = skip_pagemap_pages;
pr->id = ids++;
pr_debug("Opened page read %u (parent %u)\n",
@@ -301,6 +302,7 @@ open_old:
pr->read_page = read_page;
pr->pi = NULL;
pr->close = close_page_read;
+ pr->skip_pages = NULL;
return 1;
}
This way I can use skip pages in cr-restore.c and I am only reading
the pages I cannot restore via uffd. I could submit this as proper
patch independent of the uffd functionality.
Adrian
More information about the CRIU
mailing list