linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Bart Van Assche <bvanassche@acm.org>,
	Juri Lelli <juri.lelli@redhat.com>
Subject: [PATCH v2] sched/cputime: Make IRQ time accounting configurable at boot time
Date: Tue, 20 Jun 2023 07:10:02 -0700	[thread overview]
Message-ID: <20230620141002.23914-1-bvanassche@acm.org> (raw)

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 <mingo@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Juri Lelli <juri.lelli@redhat.com>
Cc: Vincent Guittot <vincent.guittot@linaro.org>
Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---

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(+)

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 9e5bab29685f..67a2ad3af833 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -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.
diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c
index af7952f12e6c..d9c65017024d 100644
--- a/kernel/sched/cputime.c
+++ b/kernel/sched/cputime.c
@@ -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;

             reply	other threads:[~2023-06-20 14:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-20 14:10 Bart Van Assche [this message]
2023-06-26 17:08 ` [PATCH v2] sched/cputime: Make IRQ time accounting configurable at boot time Bart Van Assche

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230620141002.23914-1-bvanassche@acm.org \
    --to=bvanassche@acm.org \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=vincent.guittot@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).