mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-23 19:04:45 +03:00
Skip dbuf_evict_one() from dbuf_evict_notify() for reclaim thread
Avoid calling dbuf_evict_one() from memory reclaim contexts (e.g. Linux kswapd, FreeBSD pagedaemon). This prevents deadlock caused by reclaim threads waiting for the dbuf hash lock in the call sequence: dbuf_evict_one -> dbuf_destroy -> arc_buf_destroy Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Alexander Motin <alexander.motin@TrueNAS.com> Signed-off-by: Kaitlin Hoang <kthoang@amazon.com> Closes #17561
This commit is contained in:
committed by
Alexander Motin
parent
4808641e71
commit
c405a7a35c
+9
-1
@@ -866,8 +866,16 @@ dbuf_evict_notify(uint64_t size)
|
||||
* and grabbing the lock results in massive lock contention.
|
||||
*/
|
||||
if (size > dbuf_cache_target_bytes()) {
|
||||
if (size > dbuf_cache_hiwater_bytes())
|
||||
/*
|
||||
* Avoid calling dbuf_evict_one() from memory reclaim context
|
||||
* (e.g. Linux kswapd, FreeBSD pagedaemon) to prevent deadlocks.
|
||||
* Memory reclaim threads can get stuck waiting for the dbuf
|
||||
* hash lock.
|
||||
*/
|
||||
if (size > dbuf_cache_hiwater_bytes() &&
|
||||
!current_is_reclaim_thread()) {
|
||||
dbuf_evict_one();
|
||||
}
|
||||
cv_signal(&dbuf_evict_cv);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user