From: Hugo Lefeuvre Date: Fri, 25 Jun 2021 08:28:28 +0000 (+0200) Subject: lib/ukboot: add bindings for Mimalloc allocator X-Git-Tag: RELEASE-0.6~161 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=4b31168c8e7fa8ba033f8b238725ace8faaf5928;p=unikraft%2Funikraft.git lib/ukboot: add bindings for Mimalloc allocator 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 Reviewed-by: Simon Kuenzer Tested-by: Unikraft CI GitHub-Pull-Request: #237 --- diff --git a/lib/ukboot/Config.uk b/lib/ukboot/Config.uk index 9e2996d7a..2728f074f 100644 --- a/lib/ukboot/Config.uk +++ b/lib/ukboot/Config.uk @@ -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 diff --git a/lib/ukboot/boot.c b/lib/ukboot/boot.c index dc07cd5bc..ff4c371f3 100644 --- a/lib/ukboot/boot.c +++ b/lib/ukboot/boot.c @@ -43,6 +43,8 @@ #include #elif CONFIG_LIBUKBOOT_INITREGION #include +#elif CONFIG_LIBUKBOOT_INITMIMALLOC +#include #elif CONFIG_LIBUKBOOT_INITTLSF #include #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