[CRIU] [PATCH] parasite: heap engine update

Kinsbursky Stanislav skinsbursky at openvz.org
Tue Feb 28 05:27:48 EST 2012


1) Use macro for defining size mapped size.
2) Allow to allocate all space (including the last byte).

Signed-off-by: Stanislav Kinsbursky <skinsbursky at openvz.org>

---
 parasite.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/parasite.c b/parasite.c
index 17a0c9d..97428ce 100644
--- a/parasite.c
+++ b/parasite.c
@@ -15,9 +15,11 @@ static struct vma_entry vma;
 static int logfd = -1;
 static int tsock = -1;
 
+#define MAX_BUF_SIZE	10 * 1024 * 1024	/* Hope 10MB will be enough...  */
+
 static int brk_init(void)
 {
-	unsigned long heap_size = 10 * 1024 * 1024;
+	unsigned long heap_size = MAX_BUF_SIZE;
 	unsigned long ret;
 	/*
 	 *  Map 10 MB. Hope this will be enough for unix skb's...
@@ -41,7 +43,7 @@ static void brk_fini(void)
 static void *brk_alloc(unsigned long bytes)
 {
 	void *addr = NULL;
-	if (brk_end > (brk_tail + bytes)) {
+	if (brk_end >= (brk_tail + bytes)) {
 		addr	= brk_tail;
 		brk_tail+= bytes;
 	}



More information about the CRIU mailing list