Optimize spl_kmem_cache_free()

Because only virtual slabs may have emergency objects and these
objects are guaranteed to have physical addresses.  It can be
easily determined if the passed object is a virtual slab object
or an emergency object.  This allows us to completely optimize
the emergency object free case out of the common free path.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
This commit is contained in:
Brian Behlendorf 2012-10-30 11:21:42 -07:00
parent ed3163484d
commit a1af8fb1ea

View File

@ -2023,11 +2023,12 @@ spl_kmem_cache_free(spl_kmem_cache_t *skc, void *obj)
atomic_inc(&skc->skc_ref); atomic_inc(&skc->skc_ref);
/* /*
* Emergency objects are never part of the virtual address space * Only virtual slabs may have emergency objects and these objects
* so if we get a virtual address we can optimize this check out. * are guaranteed to have physical addresses. They must be removed
* from the tree of emergency objects and the freed.
*/ */
if (!kmem_virt(obj) && !spl_emergency_free(skc, obj)) if ((skc->skc_flags & KMC_VMEM) && !kmem_virt(obj))
SGOTO(out, 0); SGOTO(out, spl_emergency_free(skc, obj));
local_irq_save(flags); local_irq_save(flags);