[CRIU] [PATCH] rst-malloc: adjust free_bytes in rst_mem_align_cpos
Andrey Vagin
avagin at openvz.org
Thu Mar 24 12:13:00 PDT 2016
From: Andrei Vagin <avagin at virtuozzo.com>
We need to adjust free_bytes each time when we change free_bytes.
https://github.com/xemul/criu/issues/140
Signed-off-by: Andrew Vagin <avagin at virtuozzo.com>
---
criu/rst-malloc.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/criu/rst-malloc.c b/criu/rst-malloc.c
index d394997..2702efd 100644
--- a/criu/rst-malloc.c
+++ b/criu/rst-malloc.c
@@ -128,8 +128,11 @@ unsigned long rst_mem_align_cpos(int type)
{
struct rst_mem_type_s *t = &rst_mems[type];
BUG_ON(!t->remapable || !t->enabled);
+ void *ptr;
- t->free_mem = (void *) round_up((unsigned long)t->free_mem, sizeof(void *));
+ ptr = (void *) round_up((unsigned long)t->free_mem, sizeof(void *));
+ t->free_bytes -= (ptr - t->free_mem);
+ t->free_mem = ptr;
return t->free_mem - t->buf;
}
--
2.5.0
More information about the CRIU
mailing list