[CRIU] [PATCHv0 5/8] shmem: implement dirty page tracking for anon shared memory
Pavel Emelyanov
xemul at parallels.com
Tue Dec 8 04:59:02 PST 2015
On 12/06/2015 04:15 PM, Eugene Batalov wrote:
> From: Fyodor <bocharovfedor at gmail.com>
>
> To track anon shared vma pages dirtiness we create a bitmap for it.
> Each bit in this bitmap corresponds to particular page in vma. Bit with
> value of 1 in this map states that page is dirty. Bit 0 states that the
> page is clean.
>
> Signed-off-by: Fyodor Bocharov <fbocharov at yandex.ru>
> Signed-off-by: Eugene Batalov <eabatalov89 at gmail.com>
> ---
> cr-dump.c | 18 ++++++++++++++----
> include/shmem.h | 3 ++-
> shmem.c | 47 ++++++++++++++++++++++++++++++++++++++++++++---
> 3 files changed, 60 insertions(+), 8 deletions(-)
>
> diff --git a/cr-dump.c b/cr-dump.c
> index 466880e..e96c3a3 100644
> --- a/cr-dump.c
> +++ b/cr-dump.c
> @@ -82,6 +82,7 @@
> #include "seccomp.h"
> #include "seize.h"
> #include "fault-injection.h"
> +#include "pagemap-cache.h"
>
> #include "asm/dump.h"
>
> @@ -407,6 +408,7 @@ static int dump_task_mm(pid_t pid, const struct proc_pid_stat *stat,
> MmEntry mme = MM_ENTRY__INIT;
> struct vma_area *vma_area;
> int ret = -1, i = 0;
> + pmc_t pmc = PMC_INIT;
>
> pr_info("\n");
> pr_info("Dumping mm (pid: %d)\n", pid);
> @@ -415,10 +417,15 @@ static int dump_task_mm(pid_t pid, const struct proc_pid_stat *stat,
> mme.n_vmas = vma_area_list->nr;
> mme.vmas = xmalloc(mme.n_vmas * sizeof(VmaEntry *));
> if (!mme.vmas)
> - goto err;
> + goto init_err;
> +
> + if (pmc_init(&pmc, pid, &vma_area_list->h,
> + vma_area_list->longest * PAGE_SIZE))
> + goto init_err;
This 2nd pmc walk is not cool. Can we pick up dirty bits for shared areas in
__parasite_dump_pages_seized()? There's already a loop over vma-s and the
pmc is already set up, so adding another "if (vma is anon shared)" into the
list_for_each_entry(vma_area, &vma_area_list->h, list) loop should work.
>
> list_for_each_entry(vma_area, &vma_area_list->h, list) {
> VmaEntry *vma = vma_area->e;
> + u64 *map;
>
> pr_info_vma(vma_area);
>
More information about the CRIU
mailing list