[CRIU] [PATCH 1/2] mem: Don't shrink the number of IOVs needed for page transferring

Cyrill Gorcunov gorcunov at openvz.org
Mon May 5 08:48:28 PDT 2014


In a worst scenario we need one IOV for every page we're transferring
from the parasite, thus don't divide by two here, otherwise we may
overwrite parasite zone allocated for arguments.

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 mem.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/mem.c b/mem.c
index 757bca7728ce..570de571af0b 100644
--- a/mem.c
+++ b/mem.c
@@ -59,14 +59,10 @@ int do_task_reset_dirty_track(int pid)
 
 unsigned int dump_pages_args_size(struct vm_area_list *vmas)
 {
-	/*
-	 * In the worst case I need one iovec for half of the
-	 * pages (e.g. every odd/even)
-	 */
-
+	/* In the worst case I need one iovec for each page */
 	return sizeof(struct parasite_dump_pages_args) +
 		vmas->nr * sizeof(struct parasite_vma_entry) +
-		(vmas->priv_size + 1) * sizeof(struct iovec) / 2;
+		(vmas->priv_size + 1) * sizeof(struct iovec);
 }
 
 static inline bool should_dump_page(VmaEntry *vmae, u64 pme)
@@ -256,8 +252,8 @@ static int __parasite_dump_pages_seized(struct parasite_ctl *ctl,
 		return -1;
 
 	ret = -1;
-	pp = create_page_pipe(vma_area_list->priv_size / 2,
-				pargs_iovs(args), pp_ret == NULL);
+	pp = create_page_pipe(vma_area_list->priv_size,
+			      pargs_iovs(args), pp_ret == NULL);
 	if (!pp)
 		goto out;
 
-- 
1.8.3.1



More information about the CRIU mailing list