[CRIU] [crtools-bot for Kinsbursky Stanislav ] parasite: heap engine update

Cyrill Gorcunov gorcunov at openvz.org
Tue Feb 28 06:34:34 EST 2012


The commit is pushed to "master" and will appear on git://github.com/cyrillos/crtools.git
------>
commit 7bc585b22617314d630714eaa965c67411d1c39c
Author: Kinsbursky Stanislav <skinsbursky at openvz.org>
Date:   Tue Feb 28 13:27:48 2012 +0300

    parasite: heap engine update
    
    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>
    Acked-by: Pavel Emelyanov <xemul at parallels.com>
    [gorcunov@: MAX_BUF_SIZE tuneup, don't use ops without braces)]
    Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 parasite.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/parasite.c b/parasite.c
index 830bea3..a2bdb26 100644
--- a/parasite.c
+++ b/parasite.c
@@ -28,9 +28,11 @@ static struct vma_entry vma;
 static int logfd = -1;
 static int tsock = -1;
 
+#define MAX_BUF_SIZE	(10 << 20)	/* 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...
@@ -54,7 +56,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