summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorDebabrata Banerjee <[email protected]>2017-03-15 18:46:46 -0400
committerBrian Behlendorf <[email protected]>2017-05-02 15:49:36 -0400
commitb855550c336c04b2bde85d9ffbd893b196fdd7b5 (patch)
tree61adf0034768e82edf199b1c5665c93eb0a0bbc4 /module
parent30fffb90218fd44466288d3a3d359271504c4f76 (diff)
Stop double reclaiming or not reclaiming at all
Move arcstat_need_free increment from all direct calls to when arc_reclaim_lock is busy and we exit wihout doing anything. Data will be reclaimed in reclaim thread. The previous location meant that we both reclaim the memory in this thread, and also schedule the same amount of memory for reclaim in arc_reclaim, effectively doubling the requested reclaim. AKAMAI: zfs: CR 3695072 Reviewed-by: Tim Chase <[email protected]> Reviewed-by: Richard Yao <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Debabrata Banerjee <[email protected]> Issue #6035
Diffstat (limited to 'module')
-rw-r--r--module/zfs/arc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/module/zfs/arc.c b/module/zfs/arc.c
index fa69e1ea4..b18c7a586 100644
--- a/module/zfs/arc.c
+++ b/module/zfs/arc.c
@@ -4414,8 +4414,10 @@ __arc_shrinker_func(struct shrinker *shrink, struct shrink_control *sc)
return (SHRINK_STOP);
/* Reclaim in progress */
- if (mutex_tryenter(&arc_reclaim_lock) == 0)
+ if (mutex_tryenter(&arc_reclaim_lock) == 0) {
+ ARCSTAT_INCR(arcstat_need_free, ptob(sc->nr_to_scan));
return (SHRINK_STOP);
+ }
mutex_exit(&arc_reclaim_lock);
@@ -4453,7 +4455,6 @@ __arc_shrinker_func(struct shrinker *shrink, struct shrink_control *sc)
ARCSTAT_BUMP(arcstat_memory_indirect_count);
} else {
arc_no_grow = B_TRUE;
- ARCSTAT_INCR(arcstat_need_free, ptob(sc->nr_to_scan));
ARCSTAT_BUMP(arcstat_memory_direct_count);
}