]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ARM: Add irqtime accounting support
authorRussell King <rmk+kernel@arm.linux.org.uk>
Sun, 9 Sep 2012 17:39:28 +0000 (18:39 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Sun, 9 Sep 2012 23:17:29 +0000 (00:17 +0100)
Add support for irq time accounting.  This commit prepares ARM by adding
the call to enable_sched_clock_irqtime() in sched_clock().  We introduce
a new kernel parameter - irqtime - which takes an integer.  -1 for auto,
0 for disabled, and 1 for enabled.  Auto mode selects IRQ accounting if
we have a sched_clock() tick rate greater than 1MHz.

Frederic Weisbecker is working on a patch set which moves the
IRQ_TIME_ACCOUNTING into arch/, so that part is not incorporated into
this patch; this facility becomes available on ARM only when both this
patch and Frederic's patches are merged.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/kernel/sched_clock.c

index 27d186abbc06f8aa3aa6310faa5b67039d447f03..9b8451a4330fc51430b74be032096dc22752c78b 100644 (file)
@@ -9,6 +9,7 @@
 #include <linux/init.h>
 #include <linux/jiffies.h>
 #include <linux/kernel.h>
+#include <linux/moduleparam.h>
 #include <linux/sched.h>
 #include <linux/syscore_ops.h>
 #include <linux/timer.h>
@@ -25,6 +26,9 @@ struct clock_data {
 
 static void sched_clock_poll(unsigned long wrap_ticks);
 static DEFINE_TIMER(sched_clock_timer, sched_clock_poll, 0, 0);
+static int irqtime = -1;
+
+core_param(irqtime, irqtime, int, 0400);
 
 static struct clock_data cd = {
        .mult   = NSEC_PER_SEC / HZ,
@@ -145,6 +149,10 @@ void __init setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate)
         */
        cd.epoch_ns = 0;
 
+       /* Enable IRQ time accounting if we have a fast enough sched_clock */
+       if (irqtime > 0 || (irqtime == -1 && rate >= 1000000))
+               enable_sched_clock_irqtime();
+
        pr_debug("Registered %pF as sched_clock source\n", read);
 }