Commit 216658cd authored by Pavel Emelyanov's avatar Pavel Emelyanov

vma: Keep pointer on parent vma

We currently keep pointer on parent vma bitmap, but more info
about the parent will be needed soon.
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent 5ca537a2
......@@ -52,8 +52,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 */
};
};
......
......@@ -615,7 +615,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);
......@@ -742,8 +742,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)
......@@ -800,13 +800,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;
......
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