Commit 68d5cb63 authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

restore: add statistics about restored pages

Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 5d712b74
...@@ -260,6 +260,10 @@ static int restore_priv_vma_content(pid_t pid) ...@@ -260,6 +260,10 @@ static int restore_priv_vma_content(pid_t pid)
struct vma_area *vma; struct vma_area *vma;
int fd, ret = 0; int fd, ret = 0;
unsigned int nr_restored = 0;
unsigned int nr_shared = 0;
unsigned int nr_droped = 0;
vma = list_first_entry(&rst_vma_list, struct vma_area, list); vma = list_first_entry(&rst_vma_list, struct vma_area, list);
fd = open_image_ro(CR_FD_PAGES, pid); fd = open_image_ro(CR_FD_PAGES, pid);
...@@ -304,10 +308,13 @@ static int restore_priv_vma_content(pid_t pid) ...@@ -304,10 +308,13 @@ static int restore_priv_vma_content(pid_t pid)
p = (void *) (va - vma->vma.start + p = (void *) (va - vma->vma.start +
vma_premmaped_start(&vma->vma)); vma_premmaped_start(&vma->vma));
if (memcmp(p, buf, PAGE_SIZE) == 0) if (memcmp(p, buf, PAGE_SIZE) == 0) {
nr_shared++;
continue; continue;
}
memcpy(p, buf, PAGE_SIZE); memcpy(p, buf, PAGE_SIZE);
nr_restored++;
} }
close(fd); close(fd);
...@@ -334,9 +341,14 @@ static int restore_priv_vma_content(pid_t pid) ...@@ -334,9 +341,14 @@ static int restore_priv_vma_content(pid_t pid)
return -1; return -1;
} }
i++; i++;
nr_droped++;
} }
} }
pr_info("nr_restored_pages: %d\n", nr_restored);
pr_info("nr_shared_pages: %d\n", nr_shared);
pr_info("nr_droped_pages: %d\n", nr_droped);
return 0; return 0;
} }
......
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