Whamcloud - gitweb
LU-17181 misc: don't block reclaim threads 27/52627/2
authorAlexey Lyashkov <alexey.lyashkov@hpe.com>
Wed, 11 Oct 2023 09:04:32 +0000 (12:04 +0300)
committerOleg Drokin <green@whamcloud.com>
Wed, 8 Nov 2023 21:58:27 +0000 (21:58 +0000)
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 <alexey.lyashkov@hpe.com>
Change-Id: I624edbb8833975864706ec51537d2954f5a9cea4
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/52627
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andrew Perepechko <andrew.perepechko@hpe.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/obdclass/lu_object.c

index e413f30..ec175e7 100644 (file)
@@ -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);
                /*