[CRIU] [PATCH 1/2] restore: Fix up restorer_get_vma_hint

Cyrill Gorcunov gorcunov at openvz.org
Fri Mar 2 13:58:20 EST 2012


There was a typo in prev_vma_end2 comparision,
so fix it and simplify code a bit.

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 cr-restore.c |   18 ++++++++----------
 1 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/cr-restore.c b/cr-restore.c
index e70c509..2e3b01a 100644
--- a/cr-restore.c
+++ b/cr-restore.c
@@ -1512,21 +1512,19 @@ static long restorer_get_vma_hint(pid_t pid, struct list_head *self_vma_list, lo
 		}
 
 		if ((vma.start - prev_vma_end) > vma_len) {
-			unsigned long prev_vma_end2 = 0;
+			unsigned long prev_self_vma_end = 0;
 
 			list_for_each_entry(vma_area, self_vma_list, list) {
-				if (!prev_vma_end2) {
-					prev_vma_end2 = vma_area->vma.end;
-					continue;
-				}
 
-				if ((prev_vma_end2 >= prev_vma_end2) &&
-						(vma_area->vma.start - prev_vma_end2) > vma_len) {
-					hint = prev_vma_end2;
-					goto found;
+				if (!prev_self_vma_end					||
+				    (vma_area->vma.start - prev_self_vma_end) < vma_len ||
+				    prev_self_vma_end < prev_vma_end) {
+					prev_self_vma_end = vma_area->vma.end;
+					continue;
 				}
 
-				prev_vma_end2 = vma_area->vma.end;
+				hint = prev_self_vma_end;
+				goto found;
 			}
 		}
 
-- 
1.7.7.6



More information about the CRIU mailing list