]> xenbits.xensource.com Git - unikraft/unikraft.git/commitdiff
lib/ukboot: add bindings for Mimalloc allocator
authorHugo Lefeuvre <hugo.lefeuvre@manchester.ac.uk>
Fri, 25 Jun 2021 08:28:28 +0000 (10:28 +0200)
committerUnikraft <monkey@unikraft.io>
Fri, 25 Jun 2021 08:49:55 +0000 (08:49 +0000)
This commits allows users to select Mimalloc as default system
allocator. Previously users had to patch the main tree to achieve this.
While adding more an more "hardcoded" allocators like this is certainly
not a long term solution, this is the only one we have for now.

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: #237

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

index 9e2996d7a7a8146bfd941219571bf101bab08675..2728f074f07d63fb9130f5f679f92f6c97da4029 100644 (file)
@@ -92,6 +92,11 @@ if LIBUKBOOT
                  Satisfy allocation as fast as possible. No support for free().
                  Refer to help in ukallocregion for more information.
 
+               config LIBUKBOOT_INITMIMALLOC
+               bool "Mimalloc"
+               depends on LIBMIMALLOC_INCLUDED
+               select LIBMIMALLOC
+
                config LIBUKBOOT_INITTLSF
                bool "TLSF"
                depends on LIBTLSF_INCLUDED
index dc07cd5bc1ac52e097325fbbee2f6480371394e7..ff4c371f3a57cab0ab7d665ee2b49ad33e85c9c0 100644 (file)
@@ -43,6 +43,8 @@
 #include <uk/allocbbuddy.h>
 #elif CONFIG_LIBUKBOOT_INITREGION
 #include <uk/allocregion.h>
+#elif CONFIG_LIBUKBOOT_INITMIMALLOC
+#include <uk/mimalloc.h>
 #elif CONFIG_LIBUKBOOT_INITTLSF
 #include <uk/tlsf.h>
 #endif
@@ -236,6 +238,8 @@ void ukplat_entry(int argc, char *argv[])
                        a = uk_allocbbuddy_init(md.base, md.len);
 #elif CONFIG_LIBUKBOOT_INITREGION
                        a = uk_allocregion_init(md.base, md.len);
+#elif CONFIG_LIBUKBOOT_INITMIMALLOC
+                       a = uk_mimalloc_init(md.base, md.len);
 #elif CONFIG_LIBUKBOOT_INITTLSF
                        a = uk_tlsf_init(md.base, md.len);
 #endif