Andrea Arcangeli wrote: > > > > > Ok, so you agree that your changes are only beneficial in one case: > > > > kmem_cache_free(), uniprocessor or SMP not-per-cpu cached. > > I wouldn't say "not only in such case" but "mainly in such case" > (there's not infinite ram in the per-cpu caches). > Large object were LIFO even without your patch.  Small objects on UP with partial slabs were LIFO without your patch. Small objects on UP without any partial slabs were not LIFO, but it was simple to fix that (patch attached, not yet fully tested). Small objects on SMP are managed in the per-cpu arrays - and transfered in batches (by default 30-120 objects, depending on the size) to the backend slab lists. The backend was not LIFO (also fixed in the patch). > > Also I believe there are more interesting parts to optimize on the > design side rather than making the slab.c implementation more complex > with the object of microoptimization for microbenchmarks (as you told me > you couldn't measure any decrease in performance in real life in a > sendfile benchmark, infact the first run with the patch was a little > faster and the second a little slower). > Interesting: you loose all microbenchmarks, your patch doesn't improve LIFO ordering, and you still think your patch is better? Could you explain why? Btw, I didn't merge the current slab.c directly: Ingo Molnar compared it with his own version and sent it to Linus because it was faster than his version (8-way, tux optimization). But I agree that redesign is probably a good idea for 2.5, but that's 2.5 stuff: * microoptimization: try to avoid the division in kmem_cache_free_one. Might give a 20 % boost on UP i386, even more on cpus without an efficient hardware division. I have an (ugly) patch. Mark Hemment's version avoided the division in some cases, and that really helps. * redesign: the code relies on a fast virt_to_page(). Is that realistic with NUMA/CONFIG_DISCONTIGMEM? * redesign: inode and dcache currently drain the per-cpu caches very often to reduce the fragmentation - perhaps another, stronger defragmenting allocator for inode & dcache? CPU crosscalls can't be the perfect solution. * redesign: NUMA. But that redesign - virt_to_page is the first function in kmem_cache_free and kfree - you won't need a backend simplification, more a rewrite. -- Manfred