From: Andrei Gogonea Date: Fri, 6 Dec 2019 18:14:56 +0000 (+0200) Subject: patches: Limit all memory allocations to maximum 4K bytes X-Git-Tag: RELEASE-0.4~12 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=e9c109f028e5ed8135ba0cf73fe15022649591fb;p=unikraft%2Flibs%2Fruby.git patches: Limit all memory allocations to maximum 4K bytes We currently do not support allocations greater than 4K and that is because we do not have a proper page tables implementation yet and a complete mmap() implementation. Therefore this patch should be removed when we will have these in Unikraft. Signed-off-by: Andrei Gogonea Signed-off-by: Costin Lupu Reviewed-by: Stefan Teodorescu --- diff --git a/patches/0001-Set-maximum-allocation-size-to-4K.patch b/patches/0001-Set-maximum-allocation-size-to-4K.patch new file mode 100644 index 0000000..4660913 --- /dev/null +++ b/patches/0001-Set-maximum-allocation-size-to-4K.patch @@ -0,0 +1,43 @@ +From 2cf7cf83a62d613255bfbe60a5f3b52bff94594a Mon Sep 17 00:00:00 2001 +From: Andrei Gogonea +Date: Sun, 1 Dec 2019 12:38:07 +0200 +Subject: [PATCH] Set maximum allocation size to 4K + +This should be reverted once we will have page tables support. + +Signed-off-by: Andrei Gogonea +Signed-off-by: Costin Lupu +--- + gc.c | 2 +- + transient_heap.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/gc.c b/gc.c +index 0df7189..f926c69 100644 +--- a/gc.c ++++ b/gc.c +@@ -650,7 +650,7 @@ typedef struct rb_objspace { + + + /* default tiny heap size: 16KB */ +-#define HEAP_PAGE_ALIGN_LOG 14 ++#define HEAP_PAGE_ALIGN_LOG 12 + #define CEILDIV(i, mod) (((i) + (mod) - 1)/(mod)) + enum { + HEAP_PAGE_ALIGN = (1UL << HEAP_PAGE_ALIGN_LOG), +diff --git a/transient_heap.c b/transient_heap.c +index 55a7963..01bdac2 100644 +--- a/transient_heap.c ++++ b/transient_heap.c +@@ -51,7 +51,7 @@ + #define TRANSIENT_HEAP_PROMOTED_DEFAULT_SIZE 1024 + + /* K M */ +-#define TRANSIENT_HEAP_BLOCK_SIZE (1024 * 32 ) /* 32KB int16_t */ ++#define TRANSIENT_HEAP_BLOCK_SIZE (1024 * 4 ) /* 32KB int16_t */ + #define TRANSIENT_HEAP_TOTAL_SIZE (1024 * 1024 * 32) /* 32 MB */ + #define TRANSIENT_HEAP_ALLOC_MAX (1024 * 2 ) /* 2 KB */ + #define TRANSIENT_HEAP_BLOCK_NUM (TRANSIENT_HEAP_TOTAL_SIZE / TRANSIENT_HEAP_BLOCK_SIZE) +-- +2.20.1 +