2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-09-03 15:55:53 +00:00

mm: do check on shared pages only if a vma is inherited (v2)

v2: restore page contents directly into memory
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Andrey Vagin
2013-08-14 11:18:48 +04:00
committed by Pavel Emelyanov
parent 330c137c92
commit 1f9da83048

View File

@@ -339,26 +339,31 @@ static int restore_priv_vma_content(pid_t pid)
} }
off = (va - vma->vma.start) / PAGE_SIZE; off = (va - vma->vma.start) / PAGE_SIZE;
set_bit(off, vma->page_bitmap);
if (vma->ppage_bitmap)
clear_bit(off, vma->ppage_bitmap);
ret = pr.read_page(&pr, va, buf);
if (ret < 0)
break;
va += PAGE_SIZE;
p = decode_pointer((off) * PAGE_SIZE + p = decode_pointer((off) * PAGE_SIZE +
vma_premmaped_start(&vma->vma)); vma_premmaped_start(&vma->vma));
if (memcmp(p, buf, PAGE_SIZE) == 0) { set_bit(off, vma->page_bitmap);
nr_shared++; if (vma->ppage_bitmap) { /* inherited vma */
continue; clear_bit(off, vma->ppage_bitmap);
ret = pr.read_page(&pr, va, buf);
if (ret < 0)
break;
va += PAGE_SIZE;
if (memcmp(p, buf, PAGE_SIZE) == 0) {
nr_shared++; /* the page is cowed */
continue;
}
memcpy(p, buf, PAGE_SIZE);
} else {
ret = pr.read_page(&pr, va, p);
if (ret < 0)
break;
va += PAGE_SIZE;
} }
memcpy(p, buf, PAGE_SIZE);
nr_restored++; nr_restored++;
} }