From 73f7f8aef6f3255ec0829f2201261564d60052a6 Mon Sep 17 00:00:00 2001 From: Christian Helmuth Date: Thu, 9 Feb 2023 16:40:00 +0100 Subject: [PATCH] dde_linux: generalize kmalloc_order() implementation --- repos/dde_linux/src/app/wireguard/lx_emul.c | 8 ------- .../src/lib/lx_emul/shadow/mm/slab_common.c | 11 ++++++++++ repos/pc/lib/import/import-pc_lx_emul.mk | 1 - repos/pc/src/lib/pc/lx_emul/slab_common.c | 22 ------------------- repos/pc/src/pc_linux/target.inc | 1 + 5 files changed, 12 insertions(+), 31 deletions(-) delete mode 100644 repos/pc/src/lib/pc/lx_emul/slab_common.c diff --git a/repos/dde_linux/src/app/wireguard/lx_emul.c b/repos/dde_linux/src/app/wireguard/lx_emul.c index f2a4a1517b..a32acb80eb 100644 --- a/repos/dde_linux/src/app/wireguard/lx_emul.c +++ b/repos/dde_linux/src/app/wireguard/lx_emul.c @@ -70,14 +70,6 @@ int __must_check get_random_bytes_arch(void * buf, int nbytes) } -#include - -void * kmalloc_order(size_t size,gfp_t flags,unsigned int order) -{ - return kmalloc(size, flags); -} - - #include void * kvmalloc_node(size_t size,gfp_t flags,int node) diff --git a/repos/dde_linux/src/lib/lx_emul/shadow/mm/slab_common.c b/repos/dde_linux/src/lib/lx_emul/shadow/mm/slab_common.c index 0054b70677..78bae4588f 100644 --- a/repos/dde_linux/src/lib/lx_emul/shadow/mm/slab_common.c +++ b/repos/dde_linux/src/lib/lx_emul/shadow/mm/slab_common.c @@ -14,6 +14,7 @@ #include #include #include <../mm/slab.h> +#include <../mm/internal.h> #include #include @@ -48,3 +49,13 @@ size_t ksize(const void * objp) return __ksize(objp); } + + +/* + * We can use our __kmalloc() implementation here as it supports large + * allocations well. + */ +void * kmalloc_order(size_t size, gfp_t flags, unsigned int order) +{ + return __kmalloc(size, flags); +} diff --git a/repos/pc/lib/import/import-pc_lx_emul.mk b/repos/pc/lib/import/import-pc_lx_emul.mk index 55ab8d47ea..d67b81aee7 100644 --- a/repos/pc/lib/import/import-pc_lx_emul.mk +++ b/repos/pc/lib/import/import-pc_lx_emul.mk @@ -47,7 +47,6 @@ SRC_C += lx_emul/shadow/fs/sysfs/symlink.c SRC_C += lx_emul/mapping.c SRC_C += lx_emul/page_alloc.c SRC_C += lx_emul/sched_core.c -SRC_C += lx_emul/slab_common.c SRC_C += lx_emul/vmalloc.c SRC_C += lx_emul/delay.c diff --git a/repos/pc/src/lib/pc/lx_emul/slab_common.c b/repos/pc/src/lib/pc/lx_emul/slab_common.c deleted file mode 100644 index dfda36bf31..0000000000 --- a/repos/pc/src/lib/pc/lx_emul/slab_common.c +++ /dev/null @@ -1,22 +0,0 @@ -/* - * \brief Supplement for emulation of mm/slab_common.c - * \author Josef Soentgen - * \date 2022-04-05 - */ - -/* - * Copyright (C) 2022 Genode Labs GmbH - * - * This file is distributed under the terms of the GNU General Public License - * version 2. - */ - - -#include - -void * kmalloc_order(size_t size, gfp_t flags, unsigned int order) -{ - return kmalloc(size, flags); -} - - diff --git a/repos/pc/src/pc_linux/target.inc b/repos/pc/src/pc_linux/target.inc index ebcaae8d24..cf5793d16d 100644 --- a/repos/pc/src/pc_linux/target.inc +++ b/repos/pc/src/pc_linux/target.inc @@ -47,6 +47,7 @@ LX_ENABLE += FB # mandatory fs support LX_ENABLE += PROC_FS SYSFS +# disable optimization not possible in PIC code under Genode LX_DISABLE += CC_HAS_ASM_GOTO # slim down kernel by removing superfluous drivers