From 4791c0bf0bd1575ca0f78df659cfb1731f150894 Mon Sep 17 00:00:00 2001 From: Alex Kozyrev Date: Fri, 15 Feb 2019 09:25:00 -0600 Subject: [PATCH 4/4] StarlingX: Kernel Threads iSCSI If the kthread_cpus boot arg is set it means we want to affine kernel threads to the specified CPU mask as much as possible in order to avoid doing work on other CPUs. Do not allow them to run on other CPUs to prevent interference with VMs. In this commit we extend the meaning of that boot arg to also apply to the affinity of iSCSI. Signed-off-by: Alex Kozyrev Signed-off-by: Jim Somerville Signed-off-by: Abraham Arce --- drivers/target/iscsi/iscsi_target.c | 4 ++-- include/linux/cpumask.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index 8e22379..a7f1471 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c @@ -3555,8 +3555,8 @@ void iscsit_thread_get_cpumask(struct iscsi_conn *conn) * iSCSI connection's RX/TX threads will be scheduled to * execute upon. */ - ord = conn->bitmap_id % cpumask_weight(cpu_online_mask); - for_each_online_cpu(cpu) { + ord = conn->bitmap_id % cpumask_weight(cpu_kthread_mask); + for_each_kthread_cpu(cpu) { if (ord-- == 0) { cpumask_set_cpu(cpu, conn->conn_cpumask); return; diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h index 1b891bd..1761e18 100644 --- a/include/linux/cpumask.h +++ b/include/linux/cpumask.h @@ -768,6 +768,7 @@ extern const DECLARE_BITMAP(cpu_all_bits, NR_CPUS); #define for_each_possible_cpu(cpu) for_each_cpu((cpu), cpu_possible_mask) #define for_each_online_cpu(cpu) for_each_cpu((cpu), cpu_online_mask) #define for_each_present_cpu(cpu) for_each_cpu((cpu), cpu_present_mask) +#define for_each_kthread_cpu(cpu) for_each_cpu((cpu), cpu_kthread_mask) /* Wrappers for arch boot code to manipulate normally-constant masks */ void init_cpu_present(const struct cpumask *src); -- 2.7.4