summaryrefslogtreecommitdiffstats
path: root/module/spl/spl-kmem.c
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2012-10-30 11:21:42 -0700
committerBrian Behlendorf <[email protected]>2012-11-06 14:54:19 -0800
commita1af8fb1eaa08e55f6e0799779a89f455a5017f2 (patch)
tree55bf3344f8dafb379d73f4c50342ca905f306d0e /module/spl/spl-kmem.c
parented3163484d2e70df8d9c50bad9678891b26c0fa0 (diff)
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 <[email protected]>
Diffstat (limited to 'module/spl/spl-kmem.c')
-rw-r--r--module/spl/spl-kmem.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/module/spl/spl-kmem.c b/module/spl/spl-kmem.c
index 7e68522ad..5627b5590 100644
--- a/module/spl/spl-kmem.c
+++ b/module/spl/spl-kmem.c
@@ -2023,11 +2023,12 @@ spl_kmem_cache_free(spl_kmem_cache_t *skc, void *obj)
atomic_inc(&skc->skc_ref);
/*
- * Emergency objects are never part of the virtual address space
- * so if we get a virtual address we can optimize this check out.
+ * Only virtual slabs may have emergency objects and these objects
+ * 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))
- SGOTO(out, 0);
+ if ((skc->skc_flags & KMC_VMEM) && !kmem_virt(obj))
+ SGOTO(out, spl_emergency_free(skc, obj));
local_irq_save(flags);