slab/slub/slob: Linux kernel memory mngmt
In linux mm folder, there are 3 files that about kmalloc/kmem, slab/slub/slob, where slab.c defines general memory usage, slub.c defines modern memory usage, and slob.c defines embedded device memory usage.
The principle behind these 3 files are almost the same, to prevent memory fragmentation and to accelerate memory alloc/dealloc same object/item/struct.
This memory management contains several definitions: cache, slab, objects. Where a cache has objects of same type, normally cache contains several slabs, a slab consists of several pages(4KiB), a slab is consist of objects.
In system, slabinfo or cat /proc/slabinfo view all kernel slabs.
[include/linux/slub_def.h]:
struct kmem_cache is used to store info of same type slabs. Its first element is struct kmem_cache_cpu *cpu_slab, it is a ptr to slab info, which contains objects of the type(freelist). The freelist is a pointer to the first item in the slab, where stores the next item in the slab..
in kmem_cache, struct kmem_cache_order_objects oo stands for (2^oo) pages this slab consists of.