Whamcloud - gitweb
LU-18944 target: shrink grant depending on free space 26/58926/3
authorSergey Cheremencev <scherementsev@ddn.com>
Tue, 22 Apr 2025 10:51:15 +0000 (13:51 +0300)
committerOleg Drokin <green@whamcloud.com>
Tue, 27 May 2025 04:06:05 +0000 (04:06 +0000)
Shrink grant at targets when it uses more than 25% of left space.

Signed-off-by: Sergey Cheremencev <scherementsev@ddn.com>
Change-Id: I7f2fe97a05e04cce0ac9db82abe4c4bd20f194a0
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/58926
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Patrick Farrell <pfarrell@whamcloud.com>
lustre/target/tgt_grant.c

index c4e6587..8b436e9 100644 (file)
@@ -62,9 +62,6 @@ static int lbug_on_grant_miscount;
 module_param(lbug_on_grant_miscount, int, 0644);
 MODULE_PARM_DESC(lbug_on_grant_miscount, "LBUG on grant miscount");
 
-/* Clients typically hold 2x their max_rpcs_in_flight of grant space */
-#define TGT_GRANT_SHRINK_LIMIT(exp)    (2ULL * 8 * exp_max_brw_size(exp))
-
 /* Helpers to inflate/deflate grants for clients that do not support the grant
  * parameters */
 static inline u64 tgt_grant_inflate(struct tg_grants_data *tgd, u64 val)
@@ -588,8 +585,9 @@ static void tgt_grant_shrink(struct obd_export *exp, struct obdo *oa,
 
        assert_spin_locked(&tgd->tgd_grant_lock);
        LASSERT(exp);
-       if (left_space >= tgd->tgd_tot_granted_clients *
-                         TGT_GRANT_SHRINK_LIMIT(exp))
+
+       /* don't need to shrink grant if it uses less than 25% of left space */
+       if (tgd->tgd_tot_granted * 4 < left_space)
                return;
 
        grant_shrink = oa->o_grant;