Whamcloud - gitweb
EX-3880 pcc: add pcc_async_affinity for async PCC attach
authorQian Yingjin <qian@ddn.com>
Wed, 22 Sep 2021 03:39:19 +0000 (11:39 +0800)
committerAndreas Dilger <adilger@whamcloud.com>
Fri, 15 Oct 2021 17:20:36 +0000 (17:20 +0000)
This patch adds a tunable parameter "llite.*.pcc_async_affinity"
that enables or disables the CPT selection in PCC-RO asynchronous
attach for testing.

Signed-off-by: Qian Yingjin <qian@ddn.com>
Change-Id: I1473a7547555a2d6c615d37182b6cc359194aae0
Reviewed-on: https://review.whamcloud.com/45011
Reviewed-by: Yang Sheng <ys@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/llite/lproc_llite.c
lustre/llite/pcc.c
lustre/llite/pcc.h

index 0890a68..fefe5dd 100644 (file)
@@ -651,6 +651,36 @@ static ssize_t pcc_mode_store(struct kobject *kobj, struct attribute *attr,
 }
 LUSTRE_RW_ATTR(pcc_mode);
 
+static ssize_t pcc_async_affinity_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, "%d\n", super->pccs_async_affinity);
+}
+
+static ssize_t pcc_async_affinity_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;
+       bool val;
+       int rc;
+
+       rc = kstrtobool(buffer, &val);
+       if (rc)
+               return rc;
+
+       super->pccs_async_affinity = val;
+
+       return count;
+}
+LUSTRE_RW_ATTR(pcc_async_affinity);
+
 static ssize_t checksums_show(struct kobject *kobj, struct attribute *attr,
                              char *buf)
 {
@@ -1828,6 +1858,7 @@ static struct attribute *llite_attrs[] = {
        &lustre_attr_inode_cache.attr,
        &lustre_attr_pcc_async_threshold.attr,
        &lustre_attr_pcc_mode.attr,
+       &lustre_attr_pcc_async_affinity.attr,
        &lustre_attr_opencache_threshold_count.attr,
        &lustre_attr_opencache_threshold_ms.attr,
        &lustre_attr_opencache_max_ms.attr,
index 2febbfc..7fa8b64 100644 (file)
@@ -1790,7 +1790,6 @@ out:
 static int pcc_readonly_attach_async(struct file *file,
                                     struct inode *inode, __u32 roid)
 {
-       int node = cfs_cpt_spread_node(cfs_cpt_tab, CFS_CPT_ANY);
        struct pcc_attach_context *pccx = NULL;
        struct task_struct *task;
        int rc;
@@ -1805,8 +1804,17 @@ static int pcc_readonly_attach_async(struct file *file,
        if (!pccx)
                GOTO(out, rc = -ENOMEM);
 
-       task = kthread_create_on_node(pcc_readonly_attach_thread, pccx, node,
+       if (ll_i2pccs(inode)->pccs_async_affinity) {
+               /* Create a attach kthread on the current node. */
+               task = kthread_create(pcc_readonly_attach_thread, pccx,
                                      "ll_pcc_%u", current->pid);
+       } else {
+               int node = cfs_cpt_spread_node(cfs_cpt_tab, CFS_CPT_ANY);
+
+               task = kthread_create_on_node(pcc_readonly_attach_thread, pccx,
+                                             node, "ll_pcc_%u", current->pid);
+       }
+
        if (IS_ERR(task)) {
                rc = PTR_ERR(task);
                CERROR("%s: can't start ll_pcc thread for "DFID", rc = %d\n",
index 308b180..8f9a45f 100644 (file)
@@ -170,6 +170,7 @@ struct pcc_super {
        __u64                    pccs_generation;
        /* Size threshold for asynchrous PCC-RO attach in background. */
        __u64                    pccs_async_threshold;
+       bool                     pccs_async_affinity;
        umode_t                  pccs_mode;
 };