Re: [PATCH 1/3] mm/slub: directly load freelist from cpu partial slab in the likely case

From: Christoph Lameter (Ampere)
Date: Wed Jan 17 2024 - 17:44:21 EST


On Wed, 17 Jan 2024, Chengming Zhou wrote:

The likely case is that we get a usable slab from the cpu partial list,
we can directly load freelist from it and return back, instead of going
the other way that need more work, like reenable interrupt and recheck.

Ok I see that it could be useful to avoid the unlock_irq/lock_irq sequence in the partial cpu handling.

But we need to remove the "VM_BUG_ON(!new.frozen)" in get_freelist()
for reusing it, since cpu partial slab is not frozen. It seems
acceptable since it's only for debug purpose.

This is test for verification that the newly acquired slab is actually in frozen status. If that test is no longer necessary then this is a bug that may need to be fixed independently. Maybe this test is now required to be different depending on where the partial slab originated from? Check only necessary when taken from the per node partials?

There is some small performance improvement too, which shows by:
perf bench sched messaging -g 5 -t -l 100000

mm-stable slub-optimize
Total time 7.473 7.209

Hmm... Good avoiding the lock/relock sequence helps.