[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180417040748.212236-4-joelaf@google.com>
Date: Mon, 16 Apr 2018 21:07:47 -0700
From: Joel Fernandes <joelaf@...gle.com>
To: linux-kernel@...r.kernel.org, linux-rt-users@...r.kernel.org
Cc: Joel Fernandes <joelaf@...gle.com>,
Steven Rostedt <rostedt@...dmis.org>,
Peter Zilstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Tom Zanussi <tom.zanussi@...ux.intel.com>,
Namhyung Kim <namhyung@...nel.org>,
Thomas Glexiner <tglx@...utronix.de>,
Boqun Feng <boqun.feng@...il.com>,
Paul McKenney <paulmck@...ux.vnet.ibm.com>,
Frederic Weisbecker <fweisbec@...il.com>,
Randy Dunlap <rdunlap@...radead.org>,
Masami Hiramatsu <mhiramat@...nel.org>,
Fenguang Wu <fengguang.wu@...el.com>,
Baohong Liu <baohong.liu@...el.com>,
Vedang Patel <vedang.patel@...el.com>
Subject: [RFC v4 3/4] irqflags: Avoid unnecessary calls to trace_ if you can
With TRACE_IRQFLAGS, we call trace_ API too many times. We don't need
to if local_irq_restore or local_irq_save didn't actually do anything.
This gives around a 4% improvement in performance when doing the
following command: "time find / > /dev/null"
Also its best to avoid these calls where possible, since in this series,
the RCU code in tracepoint.h seems to be call these quite a bit and I'd
like to keep this overhead low.
Cc: Steven Rostedt <rostedt@...dmis.org>
Cc: Peter Zilstra <peterz@...radead.org>
Cc: Ingo Molnar <mingo@...hat.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
Cc: Tom Zanussi <tom.zanussi@...ux.intel.com>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Thomas Glexiner <tglx@...utronix.de>
Cc: Boqun Feng <boqun.feng@...il.com>
Cc: Paul McKenney <paulmck@...ux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@...il.com>
Cc: Randy Dunlap <rdunlap@...radead.org>
Cc: Masami Hiramatsu <mhiramat@...nel.org>
Cc: Fenguang Wu <fengguang.wu@...el.com>
Cc: Baohong Liu <baohong.liu@...el.com>
Cc: Vedang Patel <vedang.patel@...el.com>
Signed-off-by: Joel Fernandes <joelaf@...gle.com>
---
include/linux/irqflags.h | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/include/linux/irqflags.h b/include/linux/irqflags.h
index 9700f00bbc04..ea8df0ac57d3 100644
--- a/include/linux/irqflags.h
+++ b/include/linux/irqflags.h
@@ -104,19 +104,20 @@ do { \
#define local_irq_save(flags) \
do { \
raw_local_irq_save(flags); \
- trace_hardirqs_off(); \
+ if (!raw_irqs_disabled_flags(flags)) \
+ trace_hardirqs_off(); \
} while (0)
-#define local_irq_restore(flags) \
- do { \
- if (raw_irqs_disabled_flags(flags)) { \
- raw_local_irq_restore(flags); \
- trace_hardirqs_off(); \
- } else { \
- trace_hardirqs_on(); \
- raw_local_irq_restore(flags); \
- } \
+#define local_irq_restore(flags) \
+ do { \
+ if (raw_irqs_disabled_flags(flags) && !irqs_disabled()) { \
+ raw_local_irq_restore(flags); \
+ trace_hardirqs_off(); \
+ } else if (!raw_irqs_disabled_flags(flags) && irqs_disabled()) {\
+ trace_hardirqs_on(); \
+ raw_local_irq_restore(flags); \
+ } \
} while (0)
#define safe_halt() \
--
2.17.0.484.g0c8726318c-goog
Powered by blists - more mailing lists