There are three different memory allocator for the Linux kernel – SLAB, SLUB and SLOB. For larger system, Linux kernel uses SLAB until kernel version 2.6.23 and now the default is SLUB. SLOB on the otherhand is for small embedded system.
If you’re compiling any modules and get an undefined reference to malloc_sizes
error during linking, it’s very possible that module is old and uses SLAB. Check if that module includes <linux/slab_def.h>
or <linux/slab.h>
. The SLAB algorithm defines cache for storage and this cache is represented as extern struct malloc_sizes.
The solution to this is either configure the kernel to use SLAB (CONFIG_SLAB=y) – so you can get the malloc_sizes reference. Or modify your module to use SLUB instead. SLOB is not much of use unless you’re doing embedded system.