diff --git a/sys/compat/linuxkpi/common/src/linux_slab.c b/sys/compat/linuxkpi/common/src/linux_slab.c --- a/sys/compat/linuxkpi/common/src/linux_slab.c +++ b/sys/compat/linuxkpi/common/src/linux_slab.c @@ -215,7 +215,13 @@ /* sizeof(struct llist_node) is used for kfree_async(). */ _s = MAX(size, sizeof(struct llist_node)); - return (malloc(_s, M_KMALLOC, linux_check_m_flags(flags))); + if (_s < PAGE_SIZE) { + return (malloc(_s, M_KMALLOC, linux_check_m_flags(flags))); + } else { + _s = roundup(_s, PAGE_SIZE); + return (contigmalloc(_s, M_KMALLOC, linux_check_m_flags(flags), + 0, -1UL, PAGE_SIZE, 0)); + } } struct lkpi_kmalloc_ctx {