From 496b91a31568c382c50dd2fe7ce190142913eaf5 Mon Sep 17 00:00:00 2001 From: Alex Kozyrev Date: Fri, 16 Mar 2018 15:50:57 -0400 Subject: [PATCH 09/10] restrict iSCSI kthreads to CPUs in cpu_kthread_mask Do not allow them to run on other CPUs to prevent interference with VMs. Signed-off-by: Alex Kozyrev Signed-off-by: Jim Somerville Signed-off-by: Austin Sun Signed-off-by: Jiping Ma --- 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 a237f1cf9bd6..e00365a0538f 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c @@ -3593,8 +3593,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 8fcc67ea3d8c..b24159c028ac 100644 --- a/include/linux/cpumask.h +++ b/include/linux/cpumask.h @@ -820,6 +820,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.29.2