Commit e99576f6 authored by Pavel Emelyanov's avatar Pavel Emelyanov

rst: Collect stats about checked-vs-cowed pages

On restore we compare pages' contents with memcmp to check which
of them can remain shared. Report this info in restore stats.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 729ea690
......@@ -397,6 +397,9 @@ static int restore_priv_vma_content(pid_t pid)
}
}
cnt_add(CNT_PAGES_COMPARED, nr_restored + nr_shared);
cnt_add(CNT_PAGES_SKIPPED_COW, nr_shared);
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);
......
......@@ -23,7 +23,10 @@ enum {
};
enum {
RESTORE_CNT_NR_STATS = 1,
CNT_PAGES_COMPARED,
CNT_PAGES_SKIPPED_COW,
RESTORE_CNT_NR_STATS,
};
void cnt_add(int c, unsigned long val);
......
......@@ -11,6 +11,8 @@ message dump_stats_entry {
}
message restore_stats_entry {
required uint64 pages_compared = 1;
required uint64 pages_skipped_cow = 2;
}
message stats_entry {
......
......@@ -102,6 +102,9 @@ void write_stats(int what)
} else if (what == RESTORE_STATS) {
stats.restore = &rs_entry;
rs_entry.pages_compared = atomic_get(&rstats->counts[CNT_PAGES_COMPARED]);
rs_entry.pages_skipped_cow = atomic_get(&rstats->counts[CNT_PAGES_SKIPPED_COW]);
name = "restore";
} else
return;
......
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