slab: cache sizes for kmalloc

Mulyadi Santosa mulyadi.santosa at gmail.com
Thu Mar 17 19:56:46 EDT 2011


Hi....

Probably just a quick share from me...

On Fri, Mar 18, 2011 at 06:18, Maksym Planeta <mcsim.planeta at gmail.com> wrote:
> I've wrote a hook were I've counted witch object sizes are the most
> popular.

Uhuh, and why you just don't use "slabtop" utility which just use
/proc/slabinfo?

>They were objects of sizes 8 and 16 bytes, but the smallest
> available cache has size 32 bytes. So in this cache fragmentation is
> about 40%. There is big fragmentation in 512 and 1024-byte caches too --
> 25 and 35 percent correspondingly. Also there are empty caches, all DMA
> caches on my system are empty. In total there is wasting of memory.

I think 32 byte is chosen due to the size of the page in x86 32 bit ==
4 KiB... by doing that, cache is simply allocated using page_alloc (or
alloc_page? I forgot) and then later "teared apart" into slab
objects...

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com



More information about the Kernelnewbies mailing list