Skip to content

Commit 8078c5c

Browse files
committed
Skip dbuf_evict_one() from dbuf_evict_notify() for kswapd
Avoid kswapd thread hang from hash lock contention under high memory pressure in this code path: dbuf_evict_one -> dbuf_destroy -> arc_buf_destroy Signed-off-by: Kaitlin Hoang <kthoang@amazon.com>
1 parent be1e991 commit 8078c5c

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

module/zfs/dbuf.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -867,7 +867,21 @@ dbuf_evict_notify(uint64_t size)
867867
*/
868868
if (size > dbuf_cache_target_bytes()) {
869869
if (size > dbuf_cache_hiwater_bytes())
870+
#if defined(_KERNEL)
871+
/*
872+
* We saw a case where kswapd thread was hung
873+
* because it wasn't able to grab the hash lock
874+
* in this call sequence:
875+
* dbuf_evict_one -> dbuf_destroy -> arc_buf_destroy
876+
*
877+
* In order to avoid this, don't have kswapd evict
878+
* from dbuf cache.
879+
*/
880+
if (!current_is_kswapd())
881+
dbuf_evict_one();
882+
#else
870883
dbuf_evict_one();
884+
#endif
871885
cv_signal(&dbuf_evict_cv);
872886
}
873887
}

0 commit comments

Comments
 (0)