]> xenbits.xensource.com Git - unikraft/libs/ruby.git/commitdiff
patches: Limit all memory allocations to maximum 4K bytes
authorAndrei Gogonea <andrei.gogonea09@gmail.com>
Fri, 6 Dec 2019 18:14:56 +0000 (20:14 +0200)
committerCostin Lupu <costin.lupu@cs.pub.ro>
Thu, 12 Dec 2019 16:26:12 +0000 (18:26 +0200)
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 <andrei.gogonea09@gmail.com>
Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
Reviewed-by: Stefan Teodorescu <stefanl.teodorescu@gmail.com>
patches/0001-Set-maximum-allocation-size-to-4K.patch [new file with mode: 0644]

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 (file)
index 0000000..4660913
--- /dev/null
@@ -0,0 +1,43 @@
+From 2cf7cf83a62d613255bfbe60a5f3b52bff94594a Mon Sep 17 00:00:00 2001
+From: Andrei Gogonea <andrei.gogonea09@gmail.com>
+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 <andrei.gogonea09@gmail.com>
+Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
+---
+ 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
+