On Fri, 4 Jan 2008, Matt Mackall wrote: > > SLUB 32 (all memory of the 4k page is used for 128 byte objects) > > SLAB 29/30 (management structure occupies first two/three objects) > > SLOB 30(?) (Alignment results in object being 136 byte of effective size, > > we have 16 bytes leftover that could be used for a > > very small allocation. Right?) > > Don't know how you got to 136, the minimum alignment is 4 on x86. But I
Right I am thinking about 64 bit systems where the alignment is 8 bytes. > already said in my last email that SLUB would win for the special case > of power of two allocations. But as long as we're looking at worst > cases, let's consider an alloc of 257 bytes.. Yup that hits it by forcing a rounding up to a size of 512 bytes because there is no intermediate cache size before 1024. The rounding up is a pretty weak spot in terms of memory use. > SLUB 8 (1016 bytes wasted) > SLOB 15 (105 bytes wasted, with 136 bytes still usable) Well we can actually turn this around. What I gave was not actually the worst case for SLOB. The worst case is an 8 byte allocation where SLOB needs double the memory of SLUB. SLUB 512 (Nothing wasted) SLOB 256 (Half of the page wasted for metadata) SLAB 119 (32 byte mininum alloc size + management struct needs) But these are all extreme cases. Depends on the mix of allocs who wins and from what I can tell the avoiding of rounding up to a power of two gives SLOB a key advantage. If we would find the worst offenders there and use kmem_cache_alloc instead then we may be able to offset that advantage. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/