Skip to content
This repository has been archived by the owner on Feb 26, 2020. It is now read-only.

Commit

Permalink
Don't call kmem_cache_shrink from shrinker
Browse files Browse the repository at this point in the history
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 openzfs/zfs#3936)

Signed-off-by: Chunwei Chen <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes openzfs/zfs#3936
Closes #487
  • Loading branch information
Chunwei Chen authored and behlendorf committed Nov 11, 2015
1 parent 9b13f65 commit 3e7e6f3
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions module/spl/spl-kmem-cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 3e7e6f3

Please sign in to comment.