]> git.proxmox.com Git - mirror_spl.git/commitdiff
Don't call kmem_cache_shrink from shrinker
authorChunwei Chen <david.chen@osnexus.com>
Sat, 24 Oct 2015 00:17:57 +0000 (17:17 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 11 Nov 2015 21:48:31 +0000 (13:48 -0800)
Linux slab will automatically free empty slab when number of partial slab is
over min_partial, so we don't need to explicitly shrink it. In fact, calling
kmem_cache_shrink from shrinker will cause heavy contention on
kmem_cache_node->list_lock, to the point that it might cause __slab_free to
livelock (see zfsonlinux/zfs#3936)

Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes zfsonlinux/zfs#3936
Closes #487

module/spl/spl-kmem-cache.c

index 5a8493fe4c3c73515d0af77a2e6a06d48523a66c..2b4ac4afc6f3654b10288ee45e71e809361ffef9 100644 (file)
@@ -1634,16 +1634,11 @@ spl_kmem_cache_reap_now(spl_kmem_cache_t *skc, int count)
        atomic_inc(&skc->skc_ref);
 
        /*
-        * Execute the registered reclaim callback if it exists.  The
-        * per-cpu caches will be drained when is set KMC_EXPIRE_MEM.
+        * Execute the registered reclaim callback if it exists.
         */
        if (skc->skc_flags & KMC_SLAB) {
                if (skc->skc_reclaim)
                        skc->skc_reclaim(skc->skc_private);
-
-               if (spl_kmem_cache_expire & KMC_EXPIRE_MEM)
-                       kmem_cache_shrink(skc->skc_linux_cache);
-
                goto out;
        }