Re: Purpose of the mm/slab.c changes

Albert D. Cahalan (
Fri, 14 Sep 2001 20:29:43 -0400 (EDT)

Linus Torvalds writes:
> On Sun, 9 Sep 2001, Manfred Spraul wrote:

>>> it provides lifo allocations from both partial and unused slabs.
>> lifo/fifo for unused slabs is obviously superflous - free is free, it
>> doesn't matter which free page is used first/last.
> You're full of crap.
> LIFO is obviously superior due to cache re-use.

I think a bit of arch-specific code could do better.

Since I happen to have the MPC7400 manual at hand, I'll use that
for my example. This is the PowerPC "G4" chip.

The L1 cache is 8-way, 32 bytes/block, and has 128 sets. The L1
cache block replacement algorithm will select an invalid block
whenever possible. If an invalid block isn't available, then a
dirty block must go out to L2. The L2 cache is 2-way, as large
as 2 MB, and has FIFO replacement.

Now, considering that allocator:

The LIFO way: likely to suck up memory/L2 bandwidth writing
out dirty data that we don't care about, plus you risk stalling
the CPU to do this while in need of a free cache block.

The alternative: invalidate the cache line. This takes just
one instruction per cache line, and causes an address-only
bus operation at worst. Completely unrelated code may run
faster due to the availability of invalid cache lines.

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