module_param(mds_num_threads, ulong, 0444);
MODULE_PARM_DESC(mds_num_threads, "number of MDS service threads to start");
+static unsigned int mds_cpu_bind = 1;
+module_param(mds_cpu_bind, uint, 0444);
+MODULE_PARM_DESC(mds_cpu_bind,
+ "bind MDS threads to particular CPU partitions");
+
int mds_max_io_threads = 512;
module_param(mds_max_io_threads, int, 0444);
-MODULE_PARM_DESC(mds_max_io_threads, "maximum number of MDS IO service threads");
+MODULE_PARM_DESC(mds_max_io_threads,
+ "maximum number of MDS IO service threads");
+
+static unsigned int mds_io_cpu_bind = 1;
+module_param(mds_io_cpu_bind, uint, 0444);
+MODULE_PARM_DESC(mds_io_cpu_bind,
+ "bind MDS IO threads to particular CPU partitions");
+
+static char *mds_io_num_cpts;
+module_param(mds_io_num_cpts, charp, 0444);
+MODULE_PARM_DESC(mds_io_num_cpts,
+ "CPU partitions MDS IO threads should run on");
+
+static struct cfs_cpt_table *mdt_io_cptable;
static char *mds_num_cpts;
module_param(mds_num_cpts, charp, 0444);
MODULE_PARM_DESC(mds_rdpg_num_threads,
"number of MDS readpage service threads to start");
+static unsigned int mds_rdpg_cpu_bind = 1;
+module_param(mds_rdpg_cpu_bind, uint, 0444);
+MODULE_PARM_DESC(mds_rdpg_cpu_bind,
+ "bind MDS readpage threads to particular CPU partitions");
+
static char *mds_rdpg_num_cpts;
module_param(mds_rdpg_num_cpts, charp, 0444);
MODULE_PARM_DESC(mds_rdpg_num_cpts,
MODULE_PARM_DESC(mds_attr_num_threads,
"number of MDS setattr service threads to start");
+static unsigned int mds_attr_cpu_bind = 1;
+module_param(mds_attr_cpu_bind, uint, 0444);
+MODULE_PARM_DESC(mds_attr_cpu_bind,
+ "bind MDS setattr threads to particular CPU partitions");
+
static char *mds_attr_num_cpts;
module_param(mds_attr_num_cpts, charp, 0444);
MODULE_PARM_DESC(mds_attr_num_cpts,
}
mutex_unlock(&m->mds_health_mutex);
+ if (mdt_io_cptable != NULL) {
+ cfs_cpt_table_free(mdt_io_cptable);
+ mdt_io_cptable = NULL;
+ }
+
EXIT;
}
{
static struct ptlrpc_service_conf conf;
struct obd_device *obd = m->mds_md_dev.md_lu_dev.ld_obd;
+ nodemask_t *mask;
int rc = 0;
+
ENTRY;
conf = (typeof(conf)) {
.tc_nthrs_base = MDS_NTHRS_BASE,
.tc_nthrs_max = MDS_NTHRS_MAX,
.tc_nthrs_user = mds_num_threads,
- .tc_cpu_affinity = 1,
+ .tc_cpu_bind = mds_cpu_bind,
.tc_ctx_tags = LCT_MD_THREAD,
},
.psc_cpt = {
.cc_pattern = mds_num_cpts,
+ .cc_affinity = true,
},
.psc_ops = {
.so_req_handler = tgt_request_handle,
.tc_nthrs_base = MDS_RDPG_NTHRS_BASE,
.tc_nthrs_max = MDS_RDPG_NTHRS_MAX,
.tc_nthrs_user = mds_rdpg_num_threads,
- .tc_cpu_affinity = 1,
+ .tc_cpu_bind = mds_rdpg_cpu_bind,
.tc_ctx_tags = LCT_MD_THREAD,
},
.psc_cpt = {
.cc_pattern = mds_rdpg_num_cpts,
+ .cc_affinity = true,
},
.psc_ops = {
.so_req_handler = tgt_request_handle,
.tc_nthrs_base = MDS_SETA_NTHRS_BASE,
.tc_nthrs_max = MDS_SETA_NTHRS_MAX,
.tc_nthrs_user = mds_attr_num_threads,
- .tc_cpu_affinity = 1,
+ .tc_cpu_bind = mds_attr_cpu_bind,
.tc_ctx_tags = LCT_MD_THREAD,
},
.psc_cpt = {
.cc_pattern = mds_attr_num_cpts,
+ .cc_affinity = true,
},
.psc_ops = {
.so_req_handler = tgt_request_handle,
.tc_nthrs_base = MDS_NTHRS_BASE,
.tc_nthrs_max = MDS_NTHRS_MAX,
.tc_nthrs_user = mds_num_threads,
- .tc_cpu_affinity = 1,
+ .tc_cpu_bind = mds_cpu_bind,
.tc_ctx_tags = LCT_MD_THREAD |
LCT_DT_THREAD,
},
.psc_cpt = {
.cc_pattern = mds_num_cpts,
+ .cc_affinity = true,
},
.psc_ops = {
.so_req_handler = tgt_request_handle,
GOTO(err_mds_svc, rc);
}
+
+ mask = cfs_cpt_nodemask(cfs_cpt_table, CFS_CPT_ANY);
+ /* event CPT feature is disabled in libcfs level by set partition
+ * number to 1, we still want to set node affinity for io service */
+ if (cfs_cpt_number(cfs_cpt_table) == 1 && nodes_weight(*mask) > 1) {
+ int cpt = 0;
+ int i;
+
+ mdt_io_cptable = cfs_cpt_table_alloc(nodes_weight(*mask));
+ for_each_node_mask(i, *mask) {
+ if (mdt_io_cptable == NULL) {
+ CWARN("MDS failed to create CPT table\n");
+ break;
+ }
+
+ rc = cfs_cpt_set_node(mdt_io_cptable, cpt++, i);
+ if (!rc) {
+ CWARN("MDS Failed to set node %d for"
+ "IO CPT table\n", i);
+ cfs_cpt_table_free(mdt_io_cptable);
+ mdt_io_cptable = NULL;
+ break;
+ }
+ }
+ }
+
memset(&conf, 0, sizeof(conf));
conf = (typeof(conf)) {
.psc_name = LUSTRE_MDT_NAME "_io",
.bc_rep_portal = MDC_REPLY_PORTAL,
},
.psc_thr = {
- .tc_thr_name = "ll_mdt_io",
+ .tc_thr_name = LUSTRE_MDT_NAME "_io",
.tc_thr_factor = OSS_THR_FACTOR,
.tc_nthrs_init = OSS_NTHRS_INIT,
.tc_nthrs_base = OSS_NTHRS_BASE,
.tc_nthrs_max = mds_max_io_threads,
- .tc_cpu_affinity = 1,
+ .tc_nthrs_user = mds_num_threads,
+ .tc_cpu_bind = mds_io_cpu_bind,
.tc_ctx_tags = LCT_DT_THREAD | LCT_MD_THREAD,
},
+ .psc_cpt = {
+ .cc_cptable = mdt_io_cptable,
+ .cc_pattern = mdt_io_cptable == NULL ?
+ mds_io_num_cpts : NULL,
+ .cc_affinity = true,
+ },
.psc_ops = {
.so_thr_init = tgt_io_thread_init,
.so_thr_done = tgt_io_thread_done,