Re: kmem_cache_create loop for find the proper gfporder

From: Pekka Enberg
Date: Sun Mar 25 2007 - 11:30:47 EST


On 3/25/07, Bin Chen <binary.chen@xxxxxxxxx> wrote:
It is done by increase gfporder for low number to high(possibly 0 to
MAX_GFP_ORDER). But why increase the gfporder(or slab size) can
decrease the internal fragmentation?)

A simple example, suppose the slab management stuff is kept off-slab,
if the gfporder is zero, and the object size in slab is 1000, the
wasted space is 4096 mod 1000 = 96, but with 4096 * 2(increase
gfporder by 1), the space is 8192 mod 1000 = 192, 192 > 96.

You didn't simulate the algorithm long enough. If you had, you'd hit
order five which wastes only 72 bytes in your example.

Pekka
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/