Whamcloud - gitweb
LU-15393 lod: skip qos for qos_threshold_rr=100 88/46388/3
authorAlexander Boyko <alexander.boyko@hpe.com>
Mon, 31 Jan 2022 14:04:08 +0000 (09:04 -0500)
committerOleg Drokin <green@whamcloud.com>
Sat, 11 Jun 2022 05:34:10 +0000 (05:34 +0000)
Current implementation of qos allocation is called for
every statfs update. It takes lq_rw_sem for write and
recalculate penalties, even whith setting qos_threshold_rr=100.
Which means always use rr allocation. Let's skip unnecessary
locking and calculation for 100% round robin allocation.

HPE-bug-id: LUS-10388
Signed-off-by: Alexander Boyko <alexander.boyko@hpe.com>
Change-Id: I2fcc272d00a988ca4ba0f745b1d5809d65b28654
Reviewed-on: https://review.whamcloud.com/46388
Reviewed-by: Andrew Perepechko <andrew.perepechko@hpe.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Alexey Lyashkov <alexey.lyashkov@hpe.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/lu_object.h
lustre/lmv/lproc_lmv.c
lustre/lod/lod_qos.c
lustre/lod/lproc_lod.c
lustre/obdclass/lu_tgt_descs.c

index 03be5c4..14c9547 100644 (file)
@@ -1634,7 +1634,9 @@ struct lu_tgt_desc_idx {
        struct lu_tgt_desc *ldi_tgt[TGT_PTRS_PER_BLOCK];
 };
 
+
 /* QoS data for LOD/LMV */
+#define QOS_THRESHOLD_MAX 256 /* should be power of two */
 struct lu_qos {
        struct list_head         lq_svr_list;   /* lu_svr_qos list */
        struct rw_semaphore      lq_rw_sem;
index b095aa2..1f118f1 100644 (file)
@@ -157,7 +157,8 @@ static ssize_t qos_threshold_rr_show(struct kobject *kobj,
                                              obd_kset.kobj);
 
        return scnprintf(buf, PAGE_SIZE, "%u%%\n",
-                       (obd->u.lmv.lmv_qos.lq_threshold_rr * 100 + 255) >> 8);
+                       (obd->u.lmv.lmv_qos.lq_threshold_rr * 100 +
+                       (QOS_THRESHOLD_MAX - 1)) / QOS_THRESHOLD_MAX);
 }
 
 static ssize_t qos_threshold_rr_store(struct kobject *kobj,
@@ -189,7 +190,7 @@ static ssize_t qos_threshold_rr_store(struct kobject *kobj,
        if (val > 100)
                return -EINVAL;
 
-       lmv->lmv_qos.lq_threshold_rr = (val << 8) / 100;
+       lmv->lmv_qos.lq_threshold_rr = (val * QOS_THRESHOLD_MAX) / 100;
        set_bit(LQ_DIRTY, &lmv->lmv_qos.lq_flags);
 
        return count;
index d07f631..7f9b156 100644 (file)
@@ -1537,6 +1537,10 @@ static int lod_ost_alloc_qos(const struct lu_env *env, struct lod_object *lo,
        int rc = 0;
        ENTRY;
 
+       /* Totally skip qos part when qos_threshold_rr=100% */
+       if (lod->lod_ost_descs.ltd_qos.lq_threshold_rr == QOS_THRESHOLD_MAX)
+               return -EAGAIN;
+
        LASSERT(lo->ldo_comp_cnt > comp_idx && lo->ldo_comp_entries != NULL);
        lod_comp = &lo->ldo_comp_entries[comp_idx];
        stripe_count = lod_comp->llc_stripe_count;
@@ -1824,6 +1828,10 @@ int lod_mdt_alloc_qos(const struct lu_env *env, struct lod_object *lo,
 
        ENTRY;
 
+       /* Totally skip qos part when qos_threshold_rr=100% */
+       if (ltd->ltd_qos.lq_threshold_rr == QOS_THRESHOLD_MAX)
+               return -EAGAIN;
+
        LASSERT(stripe_idx <= stripe_count);
        if (stripe_idx == stripe_count)
                RETURN(stripe_count);
index 7949106..018c551 100644 (file)
@@ -678,7 +678,8 @@ static ssize_t __qos_threshold_rr_show(struct kobject *kobj,
                                            &lod->lod_ost_descs;
 
        return scnprintf(buf, PAGE_SIZE, "%d%%\n",
-                        (ltd->ltd_qos.lq_threshold_rr * 100 + 255) >> 8);
+                        (ltd->ltd_qos.lq_threshold_rr * 100 +
+                         (QOS_THRESHOLD_MAX - 1)) / QOS_THRESHOLD_MAX);
 }
 
 static ssize_t mdt_qos_threshold_rr_show(struct kobject *kobj,
@@ -732,7 +733,7 @@ static ssize_t __qos_threshold_rr_store(struct kobject *kobj,
 
        if (val > 100)
                return -EINVAL;
-       ltd->ltd_qos.lq_threshold_rr = (val << 8) / 100;
+       ltd->ltd_qos.lq_threshold_rr = (val * QOS_THRESHOLD_MAX) / 100;
        set_bit(LQ_DIRTY, &ltd->ltd_qos.lq_flags);
 
        return count;
index d872db4..1effd99 100644 (file)
@@ -283,11 +283,13 @@ int lu_tgt_descs_init(struct lu_tgt_descs *ltd, bool is_mdt)
                ltd->ltd_lmv_desc.ld_pattern = LMV_HASH_TYPE_DEFAULT;
                ltd->ltd_qos.lq_prio_free = LMV_QOS_DEF_PRIO_FREE * 256 / 100;
                ltd->ltd_qos.lq_threshold_rr =
-                       LMV_QOS_DEF_THRESHOLD_RR_PCT * 256 / 100;
+                       LMV_QOS_DEF_THRESHOLD_RR_PCT *
+                       QOS_THRESHOLD_MAX / 100;
        } else {
                ltd->ltd_qos.lq_prio_free = LOV_QOS_DEF_PRIO_FREE * 256 / 100;
                ltd->ltd_qos.lq_threshold_rr =
-                       LOV_QOS_DEF_THRESHOLD_RR_PCT * 256 / 100;
+                       LOV_QOS_DEF_THRESHOLD_RR_PCT *
+                       QOS_THRESHOLD_MAX / 100;
        }
 
        return 0;
@@ -577,8 +579,10 @@ int ltd_qos_penalties_calc(struct lu_tgt_descs *ltd)
         * creation performance
         */
        clear_bit(LQ_SAME_SPACE, &qos->lq_flags);
-       if ((ba_max * (256 - qos->lq_threshold_rr)) >> 8 < ba_min &&
-           (ia_max * (256 - qos->lq_threshold_rr)) >> 8 < ia_min) {
+       if (((ba_max * (QOS_THRESHOLD_MAX - qos->lq_threshold_rr)) /
+           QOS_THRESHOLD_MAX) < ba_min &&
+           ((ia_max * (QOS_THRESHOLD_MAX - qos->lq_threshold_rr)) /
+           QOS_THRESHOLD_MAX) < ia_min) {
                set_bit(LQ_SAME_SPACE, &qos->lq_flags);
                /* Reset weights for the next time we enter qos mode */
                set_bit(LQ_RESET, &qos->lq_flags);