[PATCH v3 08/15] sched/isolation: Add io_queue housekeeping option

Daniel Wagner
2024-08-06T12:07:30Z

Multiqueue drivers such as nvme-pci are spreading IO queues on all CPUs
for optimal performance. isolcpu users are usually more concerned about
noise on isolated CPUs. Introduce a new isolcpus mask which allows the
user to define on which CPUs IO queues should be placed.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
include/linux/sched/isolation.h | 15 +++++++++++++++
kernel/sched/isolation.c | 7 +++++++
2 files changed, 22 insertions(+)

diff --git a/include/linux/sched/isolation.h b/include/linux/sched/isolation.h
index 2b461129d1fa..0101d0fc8c00 100644
--- a/include/linux/sched/isolation.h
+++ b/include/linux/sched/isolation.h
@@ -6,6 +6,20 @@
#include <linux/init.h>
#include <linux/tick.h>

+/**
+ * enum hk_type - housekeeping cpu mask types
+ * @HK_TYPE_TIMER: housekeeping cpu mask for timers
+ * @HK_TYPE_RCU: housekeeping cpu mask for RCU
+ * @HK_TYPE_MISC: housekeeping cpu mask for miscalleanous resources
+ * @HK_TYPE_SCHED: housekeeping cpu mask for scheduling
+ * @HK_TYPE_TICK: housekeeping cpu maks for timer tick
+ * @HK_TYPE_DOMAIN: housekeeping cpu mask for general SMP balancing
+ * and scheduling algoririthms
+ * @HK_TYPE_WQ: housekeeping cpu mask for worksqueues
+ * @HK_TYPE_MANAGED_IRQ: housekeeping cpu mask for managed IRQs
+ * @HK_TYPE_KTHREAD: housekeeping cpu mask for kthreads
+ * @HK_TYPE_IO_QUEUE: housekeeping cpu mask for I/O queues
+ */
enum hk_type {
HK_TYPE_TIMER,
HK_TYPE_RCU,
@@ -16,6 +30,7 @@ enum hk_type {
HK_TYPE_WQ,
HK_TYPE_MANAGED_IRQ,
HK_TYPE_KTHREAD,
+ HK_TYPE_IO_QUEUE,
HK_TYPE_MAX
};

diff --git a/kernel/sched/isolation.c b/kernel/sched/isolation.c
index 5891e715f00d..91d7a434330c 100644
--- a/kernel/sched/isolation.c
+++ b/kernel/sched/isolation.c
@@ -18,6 +18,7 @@ enum hk_flags {
HK_FLAG_WQ = BIT(HK_TYPE_WQ),
HK_FLAG_MANAGED_IRQ = BIT(HK_TYPE_MANAGED_IRQ),
HK_FLAG_KTHREAD = BIT(HK_TYPE_KTHREAD),
+ HK_FLAG_IO_QUEUE = BIT(HK_TYPE_IO_QUEUE),
};

DEFINE_STATIC_KEY_FALSE(housekeeping_overridden);
@@ -228,6 +229,12 @@ static int __init housekeeping_isolcpus_setup(char *str)
continue;
}

+ if (!strncmp(str, "io_queue,", 9)) {
+ str += 9;
+ flags |= HK_FLAG_IO_QUEUE;
+ continue;
+ }
+
/*
* Skip unknown sub-parameter and validate that it is not
* containing an invalid character.

--
2.46.0