Whamcloud - gitweb
LU-6399 pcc: add tunable parameter for PCC attach thread
authorQian Yingjin <qian@ddn.com>
Wed, 16 Nov 2022 09:26:33 +0000 (04:26 -0500)
committerAndreas Dilger <adilger@whamcloud.com>
Sat, 19 Nov 2022 17:32:34 +0000 (17:32 +0000)
Currently the max number of kernel threads doing asynchronous
attach is a hard code value (1024 by default).
In this patch, we make it a tunable parameter:
llite.*.pcc_max_attach_thread_num

Change-Id: Ic59c15af935dd8dff586fa6be3939d4322c136d5
Signed-off-by: Qian Yingjin <qian@ddn.com>
Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/49168
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/llite/lproc_llite.c
lustre/llite/pcc.h

index c9b17b6..82421dd 100644 (file)
@@ -662,8 +662,38 @@ static ssize_t pcc_dio_attach_size_mb_store(struct kobject *kobj,
 }
 LUSTRE_RW_ATTR(pcc_dio_attach_size_mb);
 
+static ssize_t
+pcc_max_attach_thread_num_show(struct kobject *kobj, struct attribute *attr,
+                              char *buffer)
+{
+       struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
+                                             ll_kset.kobj);
+       struct pcc_super *super = &sbi->ll_pcc_super;
+
+       return sprintf(buffer, "%u\n", super->pccs_maximum_queued_attaches);
+}
+
+static ssize_t
+pcc_max_attach_thread_num_store(struct kobject *kobj, struct attribute *attr,
+                               const char *buffer, size_t count)
+{
+       struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
+                                             ll_kset.kobj);
+       struct pcc_super *super = &sbi->ll_pcc_super;
+       unsigned int val;
+       int rc;
+
+       rc = kstrtouint(buffer, 0, &val);
+       if (rc)
+               return rc;
+
+       super->pccs_maximum_queued_attaches = val;
+       return count;
+}
+LUSTRE_RW_ATTR(pcc_max_attach_thread_num);
+
 static ssize_t pcc_mode_show(struct kobject *kobj, struct attribute *attr,
-                             char *buffer)
+                            char *buffer)
 {
        struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
                                              ll_kset.kobj);
@@ -1952,6 +1982,7 @@ static struct attribute *llite_attrs[] = {
        &lustre_attr_inode_cache.attr,
        &lustre_attr_pcc_async_threshold.attr,
        &lustre_attr_pcc_dio_attach_size_mb.attr,
+       &lustre_attr_pcc_max_attach_thread_num.attr,
        &lustre_attr_pcc_mode.attr,
        &lustre_attr_pcc_async_affinity.attr,
        &lustre_attr_opencache_threshold_count.attr,
index d6a647a..9d9d462 100644 (file)
@@ -193,7 +193,7 @@ struct pcc_super {
        bool                     pccs_async_affinity;
        umode_t                  pccs_mode;
        atomic_t                 pccs_attaches_queued;
-       int                      pccs_maximum_queued_attaches;
+       unsigned int             pccs_maximum_queued_attaches;
        char                     pccs_lu_pathname[PATH_MAX]; /* lustre mnt */
 };