From 2c97684db9d9286a2916420138529b4fbd0e4bbe Mon Sep 17 00:00:00 2001 From: Alexey Lyashkov Date: Wed, 11 Oct 2023 12:04:32 +0300 Subject: [PATCH] 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. Test-Parameters: trivial HPe-bug-id: LUS-11872 Signed-off-by: Alexey Lyashkov Change-Id: I624edbb8833975864706ec51537d2954f5a9cea4 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/52627 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andrew Perepechko Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin --- lustre/obdclass/lu_object.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lustre/obdclass/lu_object.c b/lustre/obdclass/lu_object.c index e413f30..ec175e7 100644 --- a/lustre/obdclass/lu_object.c +++ b/lustre/obdclass/lu_object.c @@ -2145,7 +2145,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); @@ -2179,7 +2180,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); /* -- 1.8.3.1