[CRIU] [PATCHv1 6/8] mem: generalize page_in_parent function and make it extern
Eugene Batalov
eabatalov89 at gmail.com
Wed Dec 16 05:12:14 PST 2015
From: Fyodor Bocharov<bocharovfedor at gmail.com>
If we want to dedup anon shared memory we need to call page_in_parent.
So we need to make it extern.
Also in case of anon shared mem we have only 1 bit per page so we have to
change page_in_parent signature.
Signed-off-by: Fyodor Bocharov <fbocharov at yandex.ru>
Signed-off-by: Eugene Batalov <eabatalov89 at gmail.com>
---
include/mem.h | 1 +
mem.c | 6 +++---
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/include/mem.h b/include/mem.h
index f6808e0..edc0f67 100644
--- a/include/mem.h
+++ b/include/mem.h
@@ -7,6 +7,7 @@ struct page_pipe;
struct pstree_item;
extern int task_reset_dirty_track(int pid);
+extern bool page_in_parent(unsigned long dirty);
extern int prepare_mm_pid(struct pstree_item *i);
extern int do_task_reset_dirty_track(int pid);
extern unsigned int dump_pages_args_size(struct vm_area_list *vmas);
diff --git a/mem.c b/mem.c
index c48a22b..1597d2d 100644
--- a/mem.c
+++ b/mem.c
@@ -98,14 +98,14 @@ static inline bool should_dump_page(VmaEntry *vmae, u64 pme)
return false;
}
-static inline bool page_in_parent(u64 pme)
+bool page_in_parent(unsigned long dirty)
{
/*
* If we do memory tracking, but w/o parent images,
* then we have to dump all memory
*/
- return opts.track_mem && opts.img_parent && !(pme & PME_SOFT_DIRTY);
+ return opts.track_mem && opts.img_parent && !dirty;
}
/*
@@ -141,7 +141,7 @@ static int generate_iovs(struct vma_area *vma, struct page_pipe *pp, u64 *map, u
* page. The latter would be checked in page-xfer.
*/
- if (has_parent && page_in_parent(at[pfn])) {
+ if (has_parent && page_in_parent(at[pfn] & PME_SOFT_DIRTY)) {
ret = page_pipe_add_hole(pp, vaddr);
pages[0]++;
} else {
--
1.9.1
More information about the CRIU
mailing list