From: Sergey Cheremencev Date: Tue, 22 Apr 2025 10:51:15 +0000 (+0300) Subject: LU-18944 target: shrink grant depending on free space X-Git-Tag: 2.16.56~45 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F26%2F58926%2F3;p=fs%2Flustre-release.git LU-18944 target: shrink grant depending on free space Shrink grant at targets when it uses more than 25% of left space. Signed-off-by: Sergey Cheremencev Change-Id: I7f2fe97a05e04cce0ac9db82abe4c4bd20f194a0 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/58926 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin Reviewed-by: Patrick Farrell --- diff --git a/lustre/target/tgt_grant.c b/lustre/target/tgt_grant.c index c4e6587..8b436e9 100644 --- a/lustre/target/tgt_grant.c +++ b/lustre/target/tgt_grant.c @@ -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;