Skip to contentSkip to conversation

sched/cputime: Make IRQ time accounting configurable at boot time

PATCH In review Bart Van Assche 1 participant 2 messages Jun 20, 2023 – Jun 26, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 sched/cputime: Make IRQ time accounting configurable at boot time

IRQ time accounting reduces performance by 40% for some block storage workloads on Android. Despite this some producers of Android devices want to keep IRQ time accounting enabled.

Android devices share a single kernel binary across device vendors. Make IRQ time accounting configurable at boot time such that Android vendors can decide individually whether or not to enable IRQ time accounting.

Cc Ingo Molnar <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Juri Lelli <[email protected]>
Cc Vincent Guittot <[email protected]>
Cc Dietmar Eggemann <[email protected]>
Cc Steven Rostedt <[email protected]>

---

Changes between v1 and v2: improved patch description.

 Documentation/admin-guide/kernel-parameters.txt |  4 ++++
 kernel/sched/cputime.c                          | 13 +++++++++++++
 2 files changed, 17 insertions(+)
Documentation/admin-guide/kernel-parameters.txt +4 -0
index 9e5bab29685f..67a2ad3af833 100644
@@ -5611,6 +5611,10 @@
 			non-zero "wait" parameter.  See weight_single
 			and weight_many.
 
+	sched_clock_irqtime= [KNL]
+			Can be used to disable IRQ time accounting if
+			CONFIG_IRQ_TIME_ACCOUNTING=y.
+
 	skew_tick=	[KNL] Offset the periodic timer tick per cpu to mitigate
 			xtime_lock contention on larger systems, and/or RCU lock
 			contention on all systems with CONFIG_MAXSMP set.
kernel/sched/cputime.c +13 -0
index af7952f12e6c..d9c65017024d 100644
@@ -24,6 +24,19 @@ DEFINE_PER_CPU(struct irqtime, cpu_irqtime);
 
 static int sched_clock_irqtime;
 
+static int __init sched_clock_irqtime_setup(char *arg)
+{
+	bool enabled;
+
+	if (kstrtobool(arg, &enabled) < 0)
+		pr_err("Invalid sched_clock_irqtime value\n");
+	else
+		sched_clock_irqtime = enabled;
+	return 1;
+}
+
+__setup("sched_clock_irqtime=", sched_clock_irqtime_setup);
+
 void enable_sched_clock_irqtime(void)
 {
 	sched_clock_irqtime = 1;
#1 lore raw
Quoted 8 lines · Bart Van Assche

IRQ time accounting reduces performance by 40% for some block storage workloads on Android. Despite this some producers of Android devices want to keep IRQ time accounting enabled.

Android devices share a single kernel binary across device vendors. Make IRQ time accounting configurable at boot time such that Android vendors can decide individually whether or not to enable IRQ time accounting.

Can anyone please help with reviewing this patch?

Thanks,

Bart.