]> xenbits.xensource.com Git - unikraft/unikraft.git/commitdiff
lib/ukboot: add bindings for tinyalloc allocator
authorHugo Lefeuvre <hugo.lefeuvre@manchester.ac.uk>
Fri, 25 Jun 2021 11:17:23 +0000 (13:17 +0200)
committerUnikraft <monkey@unikraft.io>
Tue, 29 Jun 2021 08:20:04 +0000 (08:20 +0000)
This commits allows users to select tinyalloc as default system
allocator. Previously users had to patch the main tree to achieve this.

This is the tinyalloc counter part of 4b31168 (Mimalloc).

Signed-off-by: Hugo Lefeuvre <hugo.lefeuvre@manchester.ac.uk>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #238

lib/ukboot/Config.uk
lib/ukboot/boot.c

index 2728f074f07d63fb9130f5f679f92f6c97da4029..df55f2f2a4c55f217108306ca2a091d3ca9dde2a 100644 (file)
@@ -97,6 +97,17 @@ if LIBUKBOOT
                depends on LIBMIMALLOC_INCLUDED
                select LIBMIMALLOC
 
+               config LIBUKBOOT_INITTINYALLOC
+               bool "tinyalloc"
+               depends on LIBTINYALLOC_INCLUDED
+               select LIBTINYALLOC
+               help
+                 Minimalist allocator implementation, meant for use in systems
+                 with unmanaged linear memory such as WebAssembly or embedded
+                 systems. tinyalloc is highly configurable and offers high
+                 performance and reasonable memory usage when used and
+                 configured appropriately.
+
                config LIBUKBOOT_INITTLSF
                bool "TLSF"
                depends on LIBTLSF_INCLUDED
index ff4c371f3a57cab0ab7d665ee2b49ad33e85c9c0..17fabb19a6dc1afb79b11863dfea8461f1fd00f7 100644 (file)
@@ -47,6 +47,8 @@
 #include <uk/mimalloc.h>
 #elif CONFIG_LIBUKBOOT_INITTLSF
 #include <uk/tlsf.h>
+#elif CONFIG_LIBUKBOOT_INITTINYALLOC
+#include <uk/tinyalloc.h>
 #endif
 #if CONFIG_LIBUKSCHED
 #include <uk/sched.h>
@@ -242,6 +244,8 @@ void ukplat_entry(int argc, char *argv[])
                        a = uk_mimalloc_init(md.base, md.len);
 #elif CONFIG_LIBUKBOOT_INITTLSF
                        a = uk_tlsf_init(md.base, md.len);
+#elif CONFIG_LIBUKBOOT_INITTINYALLOC
+                       a = uk_tinyalloc_init(md.base, md.len);
 #endif
                } else {
                        uk_alloc_addmem(a, md.base, md.len);