From: Alexey Lyashkov Date: Wed, 11 Oct 2023 09:04:32 +0000 (+0300) Subject: LU-17181 misc: don't block reclaim threads X-Git-Tag: 2.15.7-RC1~29 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F68%2F58768%2F2;p=fs%2Flustre-release.git LU-17181 misc: don't block reclaim threads memory reclaim threads may blocked by lustre reclaim process, but lustre don't have any benifit from parallel reclaim. Lustre-change: https://review.whamcloud.com/52627 Lustre-commit: 2c97684db9d9286a2916420138529b4fbd0e4bbe Test-Parameters: trivial HPe-bug-id: LUS-11872 Signed-off-by: Alexey Lyashkov Change-Id: I624edbb8833975864706ec51537d2954f5a9cea4 Reviewed-by: Andrew Perepechko Reviewed-by: Andreas Dilger Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/58768 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/lustre/obdclass/lu_object.c b/lustre/obdclass/lu_object.c index c581211..e5ac808 100644 --- a/lustre/obdclass/lu_object.c +++ b/lustre/obdclass/lu_object.c @@ -2148,7 +2148,8 @@ static unsigned long lu_cache_shrink_count(struct shrinker *sk, if (!(sc->gfp_mask & __GFP_FS)) return 0; - down_read(&lu_sites_guard); + if (!down_read_trylock(&lu_sites_guard)) + return 0; list_for_each_entry_safe(s, tmp, &lu_sites, ls_linkage) cached += percpu_counter_read_positive(&s->ls_lru_len_counter); up_read(&lu_sites_guard); @@ -2182,7 +2183,9 @@ static unsigned long lu_cache_shrink_scan(struct shrinker *sk, */ return SHRINK_STOP; - down_write(&lu_sites_guard); + if (!down_write_trylock(&lu_sites_guard)) + return SHRINK_STOP; + list_for_each_entry_safe(s, tmp, &lu_sites, ls_linkage) { remain = lu_site_purge(&lu_shrink_env, s, remain); /*