kernel/kernel-rt/centos/patches/restrict-iSCSI-kthreads-to-CPUs-in-cpu_kthread_mask.patch
Dongqi Chen c0fee2da8e [kernel-rt 4.18] Upgrade kernel-rt to version 4.18.0-147.3.1 based on SRPM
Story: 2007308
Task: 38795
Depends-On: https://review.opendev.org/#/c/722017/
Depends-On: https://review.opendev.org/#/c/722019/
Change-Id: I942b2aa6167120157a38af83135ed358b17ee78b
Signed-off-by: Dongqi Chen <chen.dq@neusoft.com>
2020-04-30 11:25:20 +08:00

46 lines
1.9 KiB
Diff

From e2e6b3f625a3a6cc0202c60ce93ca9d300cb6b9b Mon Sep 17 00:00:00 2001
From: Alex Kozyrev <alex.kozyrev@windriver.com>
Date: Fri, 16 Mar 2018 15:50:57 -0400
Subject: [PATCH 1/2] 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 <alex.kozyrev@windriver.com>
Signed-off-by: Jim Somerville <Jim.Somerville@windriver.com>
Signed-off-by: Austin Sun <austin.sun@intel.com>
---
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 5ce6e2a40..a38c73525 100644
--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -3543,8 +3543,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 57f20a0a7..7029aeae7 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -770,6 +770,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.19.1