From 9c2d58d5ab6c414c243406796f0baa9e93ec9c7e Mon Sep 17 00:00:00 2001 From: Qian Yingjin Date: Wed, 16 Nov 2022 04:26:33 -0500 Subject: [PATCH] LU-6399 pcc: add tunable parameter for PCC attach thread 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 Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/49168 Tested-by: jenkins Tested-by: Andreas Dilger Reviewed-by: Andreas Dilger --- lustre/llite/lproc_llite.c | 33 ++++++++++++++++++++++++++++++++- lustre/llite/pcc.h | 2 +- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/lustre/llite/lproc_llite.c b/lustre/llite/lproc_llite.c index c9b17b6..82421dd 100644 --- a/lustre/llite/lproc_llite.c +++ b/lustre/llite/lproc_llite.c @@ -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, diff --git a/lustre/llite/pcc.h b/lustre/llite/pcc.h index d6a647a..9d9d462 100644 --- a/lustre/llite/pcc.h +++ b/lustre/llite/pcc.h @@ -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 */ }; -- 1.8.3.1