Commit 1f9da830 authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

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

v2: restore page contents directly into memory
Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 330c137c
......@@ -339,26 +339,31 @@ static int restore_priv_vma_content(pid_t pid)
}
off = (va - vma->vma.start) / PAGE_SIZE;
p = decode_pointer((off) * PAGE_SIZE +
vma_premmaped_start(&vma->vma));
set_bit(off, vma->page_bitmap);
if (vma->ppage_bitmap)
if (vma->ppage_bitmap) { /* inherited vma */
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 +
vma_premmaped_start(&vma->vma));
if (memcmp(p, buf, PAGE_SIZE) == 0) {
nr_shared++;
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;
}
nr_restored++;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment