Re: [MODSLAB 3/7] A Kmalloc subsystem

From: Manfred Spraul
Date: Sat Aug 19 2006 - 14:52:12 EST

Christoph Lameter wrote:

On Sat, 19 Aug 2006, Manfred Spraul wrote:

What about:

if (unlikely(addr & (~(PAGE_SIZE-1))))
slabp=addr & (~(PAGE_SIZE-1));

Well this would not be working with the simple slab design that puts the first element at the page border to simplify alignment.

And as we have just seen virt to page is mostly an address calculation in many configurations. I doubt that there would be a great advantage. Todays processors biggest cause for latencies are cacheline misses..

It involves table walking on discontigmem archs. "slabp=addr & (~(PAGE_SIZE-1));" means no pointer chasing, and the access touches the same page, i.e. definitively no TLB miss.

Some arithmetic with addresses does not seem to be that important. Misaligning data in order to not put objects on such
boundaries could be an issue.

> Modify the kmalloc caches slightly and use non-power-of-2 cache sizes. Move

the kmalloc(PAGE_SIZE) users to gfp.

Power of 2 cache sizes make the object align neatly to cacheline boundaries and make them fit tightly into a page.

IMHO not really an issue. 2kb-cache_line_size() also aligns perfectly.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at