[CRIU] [PATCH 07/20] page-pipe/page-xfer: remove PP_COMPAT (compatible iovs)
Dmitry Safonov
dsafonov at virtuozzo.com
Fri Dec 2 11:53:31 PST 2016
Parasite transfers pages in the same iovec format now: drop compatible
format (yay!).
Signed-off-by: Dmitry Safonov <dsafonov at virtuozzo.com>
---
criu/include/page-pipe.h | 7 -------
criu/mem.c | 2 --
criu/page-pipe.c | 51 ++++++++----------------------------------------
criu/page-xfer.c | 24 ++++-------------------
4 files changed, 12 insertions(+), 72 deletions(-)
diff --git a/criu/include/page-pipe.h b/criu/include/page-pipe.h
index 924b162b7449..ea91dac1e73e 100644
--- a/criu/include/page-pipe.h
+++ b/criu/include/page-pipe.h
@@ -122,15 +122,8 @@ struct page_pipe {
#define PP_CHUNK_MODE 0x1 /* Restrict the maximum buffer size of pipes
and dump memory for a few iterations */
-#define PP_COMPAT 0x2 /* Use compatible iovs (struct compat_iovec) */
#define PP_OWN_IOVS 0x4 /* create_page_pipe allocated IOVs memory */
-/* XXX: move to arch-depended file, when non-x86 add support for compat mode */
-struct iovec_compat {
- u32 iov_base;
- u32 iov_len;
-};
-
struct page_pipe *create_page_pipe(unsigned int nr_segs, struct iovec *iovs, unsigned flags);
extern void destroy_page_pipe(struct page_pipe *p);
extern int page_pipe_add_page(struct page_pipe *p, unsigned long addr,
diff --git a/criu/mem.c b/criu/mem.c
index 22586055ae4b..c4476f3cb4c3 100644
--- a/criu/mem.c
+++ b/criu/mem.c
@@ -326,8 +326,6 @@ static int __parasite_dump_pages_seized(struct pstree_item *item,
* use, i.e. on non-lazy non-predump.
*/
cpp_flags |= PP_CHUNK_MODE;
- if (!compel_mode_native(ctl))
- cpp_flags |= PP_COMPAT;
pp = create_page_pipe(vma_area_list->priv_size,
mdc->lazy ? NULL : pargs_iovs(args),
cpp_flags);
diff --git a/criu/page-pipe.c b/criu/page-pipe.c
index 89cb27b62839..4ebd0cbe8573 100644
--- a/criu/page-pipe.c
+++ b/criu/page-pipe.c
@@ -102,12 +102,6 @@ static struct page_pipe_buf *ppb_alloc_resize(struct page_pipe *pp, int size)
return ppb;
}
-static inline void iov_init_compat(struct iovec_compat *iov, unsigned long addr)
-{
- iov->iov_base = (u32)addr;
- iov->iov_len = PAGE_SIZE;
-}
-
static int page_pipe_grow(struct page_pipe *pp, unsigned int flags)
{
struct page_pipe_buf *ppb;
@@ -129,10 +123,7 @@ static int page_pipe_grow(struct page_pipe *pp, unsigned int flags)
return -1;
out:
- if (pp->flags & PP_COMPAT)
- free_iov = (void*)&((struct iovec_compat*)pp->iovs)[pp->free_iov];
- else
- free_iov = &pp->iovs[pp->free_iov];
+ free_iov = &pp->iovs[pp->free_iov];
ppb_init(ppb, 0, 0, flags, free_iov);
return 0;
@@ -243,13 +234,7 @@ static inline int try_add_page_to(struct page_pipe *pp, struct page_pipe_buf *pp
pr_debug("Add iov to page pipe (%u iovs, %u/%u total)\n",
ppb->nr_segs, pp->free_iov, pp->nr_iovs);
- if (pp->flags & PP_COMPAT) {
- struct iovec_compat *iovs = (void *)ppb->iov;
-
- iov_init_compat(&iovs[ppb->nr_segs++], addr);
- } else {
- iov_init(&ppb->iov[ppb->nr_segs++], addr);
- }
+ iov_init(&ppb->iov[ppb->nr_segs++], addr);
pp->free_iov++;
BUG_ON(pp->free_iov > pp->nr_iovs);
out:
@@ -306,13 +291,7 @@ int page_pipe_add_hole(struct page_pipe *pp, unsigned long addr,
iov_grow_page(&pp->holes[pp->free_hole - 1], addr))
goto out;
- if (pp->flags & PP_COMPAT) {
- struct iovec_compat *iovs = (void *)pp->holes;
-
- iov_init_compat(&iovs[pp->free_hole++], addr);
- } else {
- iov_init(&pp->holes[pp->free_hole++], addr);
- }
+ iov_init(&pp->holes[pp->free_hole++], addr);
pp->hole_flags[pp->free_hole - 1] = flags;
@@ -506,7 +485,6 @@ void debug_show_page_pipe(struct page_pipe *pp)
struct page_pipe_buf *ppb;
int i;
struct iovec *iov;
- struct iovec_compat *iov_c;
if (pr_quelled(LOG_DEBUG))
return;
@@ -518,28 +496,15 @@ void debug_show_page_pipe(struct page_pipe *pp)
pr_debug("\tbuf %u pages, %u iovs, flags: %x :\n",
ppb->pages_in, ppb->nr_segs, ppb->flags);
for (i = 0; i < ppb->nr_segs; i++) {
- if (pp->flags & PP_COMPAT) {
- iov_c = (void *)ppb->iov;
- pr_debug("\t\t%x %lu\n", iov_c[i].iov_base,
- (unsigned long)iov_c[i].iov_len / PAGE_SIZE);
- } else {
- iov = &ppb->iov[i];
- pr_debug("\t\t%p %lu\n", iov->iov_base,
- iov->iov_len / PAGE_SIZE);
- }
+ iov = &ppb->iov[i];
+ pr_debug("\t\t%p %lu\n", iov->iov_base,
+ iov->iov_len / PAGE_SIZE);
}
}
pr_debug("* %u holes:\n", pp->free_hole);
for (i = 0; i < pp->free_hole; i++) {
- if (pp->flags & PP_COMPAT) {
- iov_c = (void *)pp->holes;
- pr_debug("\t%x %lu\n", iov_c[i].iov_base,
- (unsigned long)iov_c[i].iov_len / PAGE_SIZE);
- } else {
- iov = &pp->holes[i];
- pr_debug("\t%p %lu\n", iov->iov_base,
- iov->iov_len / PAGE_SIZE);
- }
+ iov = &pp->holes[i];
+ pr_debug("\t%p %lu\n", iov->iov_base, iov->iov_len / PAGE_SIZE);
}
}
diff --git a/criu/page-xfer.c b/criu/page-xfer.c
index 315d152c0c7d..8141cf805747 100644
--- a/criu/page-xfer.c
+++ b/criu/page-xfer.c
@@ -353,21 +353,6 @@ static int page_xfer_dump_hole(struct page_xfer *xfer,
return 0;
}
-static struct iovec get_iov(struct iovec *iovs, unsigned int n, bool compat)
-{
- if (likely(!compat)) {
- return iovs[n];
- } else {
- struct iovec ret;
- struct iovec_compat *tmp = (struct iovec_compat*)(void *)iovs;
-
- tmp += n;
- ret.iov_base = (void *)(uintptr_t)tmp->iov_base;
- ret.iov_len = tmp->iov_len;
- return ret;
- }
-}
-
static int get_hole_flags(struct page_pipe *pp, int n)
{
unsigned int hole_flags = pp->hole_flags[n];
@@ -388,8 +373,7 @@ static int dump_holes(struct page_xfer *xfer, struct page_pipe *pp,
int ret;
for (; *cur_hole < pp->free_hole ; (*cur_hole)++) {
- struct iovec hole = get_iov(pp->holes, *cur_hole,
- pp->flags & PP_COMPAT);
+ struct iovec hole = pp->holes[*cur_hole];
u32 hole_flags;
if (limit && hole.iov_base >= limit)
@@ -419,7 +403,7 @@ int page_xfer_dump_pages(struct page_xfer *xfer, struct page_pipe *pp,
pr_debug("\tbuf %d/%d\n", ppb->pages_in, ppb->nr_segs);
for (i = 0; i < ppb->nr_segs; i++) {
- struct iovec iov = get_iov(ppb->iov, i, pp->flags & PP_COMPAT);
+ struct iovec iov = ppb->iov[i];
u32 flags = PE_PRESENT;
ret = dump_holes(xfer, pp, &cur_hole, iov.iov_base, off);
@@ -842,8 +826,8 @@ static int fill_page_pipe(struct page_read *pr, struct page_pipe *pp)
list_for_each_entry(ppb, &pp->bufs, l) {
for (i = 0; i < ppb->nr_segs; i++) {
- struct iovec iov = get_iov(ppb->iov, i,
- pp->flags & PP_COMPAT);
+ struct iovec iov = ppb->iov[i];
+
if (splice(img_raw_fd(pr->pi), NULL, ppb->p[1], NULL,
iov.iov_len, SPLICE_F_MOVE) != iov.iov_len) {
pr_perror("Splice failed");
--
2.10.2
More information about the CRIU
mailing list