mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-30 22:05:36 +00:00
Drop support for zero pagemap entries
The pagemap entries for pages mapped to zero pfn proved to be not useful... travis-ci: success for revert zero pagemaps Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com> Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
committed by
Andrei Vagin
parent
bf63367061
commit
48675a3c7e
@@ -46,7 +46,7 @@ struct page_read {
|
||||
/* reads page from current pagemap */
|
||||
int (*read_pages)(struct page_read *, unsigned long vaddr, int nr,
|
||||
void *, unsigned flags);
|
||||
/* Advance page_read to the next entry (including zero pagemaps) */
|
||||
/* Advance page_read to the next entry */
|
||||
int (*advance)(struct page_read *pr);
|
||||
void (*close)(struct page_read *);
|
||||
void (*skip_pages)(struct page_read *, unsigned long len);
|
||||
@@ -122,20 +122,14 @@ static inline unsigned long pagemap_len(PagemapEntry *pe)
|
||||
|
||||
/* Pagemap flags */
|
||||
#define PE_PARENT (1 << 0) /* pages are in parent snapshot */
|
||||
#define PE_ZERO (1 << 1) /* pages can be lazily restored */
|
||||
#define PE_LAZY (1 << 2) /* pages are mapped to zero pfn */
|
||||
#define PE_PRESENT (1 << 3) /* pages are present in pages*img */
|
||||
#define PE_LAZY (1 << 1) /* pages can be lazily restored */
|
||||
#define PE_PRESENT (1 << 2) /* pages are present in pages*img */
|
||||
|
||||
static inline bool pagemap_in_parent(PagemapEntry *pe)
|
||||
{
|
||||
return !!(pe->flags & PE_PARENT);
|
||||
}
|
||||
|
||||
static inline bool pagemap_zero(PagemapEntry *pe)
|
||||
{
|
||||
return !!(pe->flags & PE_ZERO);
|
||||
}
|
||||
|
||||
static inline bool pagemap_lazy(PagemapEntry *pe)
|
||||
{
|
||||
return !!(pe->flags & PE_LAZY);
|
||||
|
26
criu/mem.c
26
criu/mem.c
@@ -109,7 +109,7 @@ bool should_dump_page(VmaEntry *vmae, u64 pme)
|
||||
return false;
|
||||
if (vma_entry_is(vmae, VMA_AREA_AIORING))
|
||||
return true;
|
||||
if (pme & (PME_PRESENT | PME_SWAP))
|
||||
if ((pme & (PME_PRESENT | PME_SWAP)) && !page_is_zero(pme))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@@ -143,7 +143,7 @@ static int generate_iovs(struct vma_area *vma, struct page_pipe *pp, u64 *map, u
|
||||
{
|
||||
u64 *at = &map[PAGE_PFN(*off)];
|
||||
unsigned long pfn, nr_to_scan;
|
||||
unsigned long pages[4] = {};
|
||||
unsigned long pages[3] = {};
|
||||
|
||||
nr_to_scan = (vma_area_len(vma) - *off) / PAGE_SIZE;
|
||||
|
||||
@@ -167,18 +167,15 @@ 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 (page_is_zero(at[pfn])) {
|
||||
ret = page_pipe_add_hole(pp, vaddr, PP_HOLE_ZERO);
|
||||
pages[0]++;
|
||||
} else if (has_parent && page_in_parent(at[pfn] & PME_SOFT_DIRTY)) {
|
||||
if (has_parent && page_in_parent(at[pfn] & PME_SOFT_DIRTY)) {
|
||||
ret = page_pipe_add_hole(pp, vaddr, PP_HOLE_PARENT);
|
||||
pages[1]++;
|
||||
pages[0]++;
|
||||
} else {
|
||||
ret = page_pipe_add_page(pp, vaddr, ppb_flags);
|
||||
if (ppb_flags & PPB_LAZY && opts.lazy_pages)
|
||||
pages[2]++;
|
||||
pages[1]++;
|
||||
else
|
||||
pages[3]++;
|
||||
pages[2]++;
|
||||
}
|
||||
|
||||
if (ret) {
|
||||
@@ -190,13 +187,12 @@ static int generate_iovs(struct vma_area *vma, struct page_pipe *pp, u64 *map, u
|
||||
*off += pfn * PAGE_SIZE;
|
||||
|
||||
cnt_add(CNT_PAGES_SCANNED, nr_to_scan);
|
||||
cnt_add(CNT_PAGES_ZERO, pages[0]);
|
||||
cnt_add(CNT_PAGES_SKIPPED_PARENT, pages[1]);
|
||||
cnt_add(CNT_PAGES_LAZY, pages[2]);
|
||||
cnt_add(CNT_PAGES_WRITTEN, pages[3]);
|
||||
cnt_add(CNT_PAGES_SKIPPED_PARENT, pages[0]);
|
||||
cnt_add(CNT_PAGES_LAZY, pages[1]);
|
||||
cnt_add(CNT_PAGES_WRITTEN, pages[2]);
|
||||
|
||||
pr_info("Pagemap generated: %lu pages (%lu lazy) %lu holes %lu zeros\n",
|
||||
pages[3] + pages[2], pages[2], pages[1], pages[0]);
|
||||
pr_info("Pagemap generated: %lu pages (%lu lazy) %lu holes\n",
|
||||
pages[2] + pages[1], pages[1], pages[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@@ -169,8 +169,6 @@ static int write_pagemap_to_server(struct page_xfer *xfer, struct iovec *iov, u3
|
||||
cmd = PS_IOV_HOLE;
|
||||
else if (flags & PE_LAZY)
|
||||
cmd = PS_IOV_LAZY;
|
||||
else if (flags & PE_ZERO)
|
||||
cmd = PS_IOV_ZERO;
|
||||
else
|
||||
BUG();
|
||||
|
||||
@@ -411,8 +409,6 @@ static int get_hole_flags(struct page_pipe *pp, int n)
|
||||
|
||||
if (hole_flags == PP_HOLE_PARENT)
|
||||
return PE_PARENT;
|
||||
if (hole_flags == PP_HOLE_ZERO)
|
||||
return PE_ZERO;
|
||||
else
|
||||
BUG();
|
||||
|
||||
@@ -812,9 +808,6 @@ static int page_server_serve(int sk)
|
||||
case PS_IOV_HOLE:
|
||||
ret = page_server_add(sk, &pi, PE_PARENT);
|
||||
break;
|
||||
case PS_IOV_ZERO:
|
||||
ret = page_server_add(sk, &pi, PE_ZERO);
|
||||
break;
|
||||
case PS_IOV_LAZY:
|
||||
ret = page_server_add(sk, &pi, PE_LAZY);
|
||||
break;
|
||||
@@ -888,9 +881,7 @@ static int fill_page_pipe(struct page_read *pr, struct page_pipe *pp)
|
||||
unsigned long vaddr = pr->pe->vaddr;
|
||||
|
||||
for (i = 0; i < pr->pe->nr_pages; i++, vaddr += PAGE_SIZE) {
|
||||
if (pagemap_zero(pr->pe))
|
||||
ret = page_pipe_add_hole(pp, vaddr, PP_HOLE_ZERO);
|
||||
else if (pagemap_in_parent(pr->pe))
|
||||
if (pagemap_in_parent(pr->pe))
|
||||
ret = page_pipe_add_hole(pp, vaddr, PP_HOLE_PARENT);
|
||||
else
|
||||
ret = page_pipe_add_page(pp, vaddr, pagemap_lazy(pr->pe) ? PPB_LAZY : 0);
|
||||
|
@@ -125,19 +125,13 @@ int dedup_one_iovec(struct page_read *pr, unsigned long off, unsigned long len)
|
||||
|
||||
static int advance(struct page_read *pr)
|
||||
{
|
||||
for (;;) {
|
||||
pr->curr_pme++;
|
||||
if (pr->curr_pme >= pr->nr_pmes)
|
||||
return 0;
|
||||
|
||||
pe = pr->pmes[pr->curr_pme];
|
||||
|
||||
if (!pagemap_zero(pe))
|
||||
break;
|
||||
}
|
||||
|
||||
pr->pe = pr->pmes[pr->curr_pme];
|
||||
pr->cvaddr = pr->pe->vaddr;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -475,9 +469,6 @@ static int read_pagemap_page(struct page_read *pr, unsigned long vaddr, int nr,
|
||||
if (pagemap_in_parent(pr->pe)) {
|
||||
if (read_parent_page(pr, vaddr, nr, buf, flags) < 0)
|
||||
return -1;
|
||||
} else if (pagemap_zero(pr->pe)) {
|
||||
/* zero mappings should be skipped by get_pagemap */
|
||||
BUG();
|
||||
} else {
|
||||
if (pr->maybe_read_page(pr, vaddr, nr, buf, flags) < 0)
|
||||
return -1;
|
||||
|
@@ -711,7 +711,7 @@ static int do_dump_one_shmem(int fd, void *addr, struct shmem_info *si)
|
||||
pgaddr = (unsigned long)addr + pfn * PAGE_SIZE;
|
||||
again:
|
||||
if (pgstate == PST_ZERO)
|
||||
ret = page_pipe_add_hole(pp, pgaddr, PP_HOLE_ZERO);
|
||||
ret = 0;
|
||||
else if (xfer.parent && page_in_parent(pgstate == PST_DIRTY))
|
||||
ret = page_pipe_add_hole(pp, pgaddr, PP_HOLE_PARENT);
|
||||
else
|
||||
|
@@ -107,9 +107,8 @@ rfile_flags_map = [
|
||||
|
||||
pmap_flags_map = [
|
||||
('PE_PARENT', 1 << 0),
|
||||
('PE_ZERO', 1 << 1),
|
||||
('PE_LAZY', 1 << 2),
|
||||
('PE_PRESENT', 1 << 3),
|
||||
('PE_LAZY', 1 << 1),
|
||||
('PE_PRESENT', 1 << 2),
|
||||
];
|
||||
|
||||
flags_maps = {
|
||||
|
Reference in New Issue
Block a user