[CRIU] [PATCH 06/11] vma: Keep pointer on parent vma

Pavel Emelyanov xemul at virtuozzo.com
Fri May 5 09:03:02 PDT 2017


We currently keep pointer on parent vma bitmap, but more info
about the parent will be needed soon.

Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>
---
 criu/include/vma.h |  2 +-
 criu/mem.c         | 10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/criu/include/vma.h b/criu/include/vma.h
index 37f8b4b..12f03fb 100644
--- a/criu/include/vma.h
+++ b/criu/include/vma.h
@@ -54,8 +54,8 @@ struct vma_area {
 		struct /* for restore */ {
 			int (*vm_open)(int pid, struct vma_area *vma);
 			struct file_desc *vmfd;
+			struct vma_area	*pvma;		/* parent for inherited VMAs */
 			unsigned long	*page_bitmap;	/* existent pages */
-			unsigned long	*ppage_bitmap;	/* parent's existent pages */
 			unsigned long	premmaped_addr;	/* restore only */
 		};
 	};
diff --git a/criu/mem.c b/criu/mem.c
index 2d50f8e..1b805cd 100644
--- a/criu/mem.c
+++ b/criu/mem.c
@@ -646,7 +646,7 @@ static int premap_private_vma(struct pstree_item *t,
 		 * This region was found in parent -- remap it to inherit physical
 		 * pages (if any) from it (and COW them later if required).
 		 */
-		vma->ppage_bitmap = p->page_bitmap;
+		vma->pvma = p;
 
 		addr = mremap(paddr, size, size,
 				MREMAP_FIXED | MREMAP_MAYMOVE, *tgt_addr);
@@ -790,8 +790,8 @@ static int restore_priv_vma_content(struct pstree_item *t, struct page_read *pr)
 					vma->premmaped_addr);
 
 			set_bit(off, vma->page_bitmap);
-			if (vma->ppage_bitmap) { /* inherited vma */
-				clear_bit(off, vma->ppage_bitmap);
+			if (vma->pvma) { /* inherited vma */
+				clear_bit(off, vma->pvma->page_bitmap);
 
 				ret = pr->read_pages(pr, va, 1, buf, 0);
 				if (ret < 0)
@@ -848,13 +848,13 @@ err_read:
 		unsigned long size, i = 0;
 		void *addr = decode_pointer(vma->premmaped_addr);
 
-		if (vma->ppage_bitmap == NULL)
+		if (vma->pvma == NULL)
 			continue;
 
 		size = vma_entry_len(vma->e) / PAGE_SIZE;
 		while (1) {
 			/* Find all pages, which are not shared with this child */
-			i = find_next_bit(vma->ppage_bitmap, size, i);
+			i = find_next_bit(vma->pvma->page_bitmap, size, i);
 
 			if ( i >= size)
 				break;
-- 
2.5.5



More information about the CRIU mailing list