I’m studying linux slab allocation.
Following to linux kernel source code mm/slab.c, it seems like, when I request memory with kmalloc in kernel, what really happens is, the slab allocator finds the closest bigger match with number of 2’s power and returns the prepared cache (if present) but /proc/slabinfo tells me that maximum size of prepared kmalloc cache is “8192”:
kmalloc-8192 29 32 8192 4 8 : tunables ...
kmalloc-4096 70 72 4096 8 8 : tunables ...
kmalloc-2048 331 336 2048 8 4 : tunables ...
Kernel source code shows that request more than this size will fail(which I think i’m wrong) but in reality, we can kmalloc maximum 128KB.
My quiestion : Why isn’t there kmalloc-16384, kmalloc-32768, and more in /proc/slabinfo?
I assume it goes direct to the page allocator in that case. I’m not sure why it handles order-2 allocations itself though. Unless that’s because you’re on some weird 8k page architecture, which would make it order-1.