aboutsummaryrefslogtreecommitdiff
path: root/kernel/trace/trace_events.c
diff options
context:
space:
mode:
authorAlex Shi <alex.shi@linaro.org>2018-02-01 19:53:33 +0800
committerAlex Shi <alex.shi@linaro.org>2018-02-01 19:54:48 +0800
commitcd1fe2006b62234455a91e428bad45331dc79250 (patch)
tree5fca3d52a0d3f6edbb4352d6b54f3155d7e2c100 /kernel/trace/trace_events.c
parent824ce96ff92c399f5bd2ee308f231300e7e89174 (diff)
parent6fdbca2f35ee3e80079b31a5cda7bb6fec8def39 (diff)
Merge remote-tracking branch 'rt-stable/v4.4-rt' into linux-linaro-lsk-v4.4-rtlsk-v4.4-18.02-rt
Conflicts: lsk has current_stack_pointer and arch_within_stack_frames in arch/x86/include/asm/thread_info.h
Diffstat (limited to 'kernel/trace/trace_events.c')
-rw-r--r--kernel/trace/trace_events.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index 5bd79b347398..e43e45a2aa7e 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -2310,6 +2310,7 @@ void trace_event_enum_update(struct trace_enum_map **map, int len)
{
struct trace_event_call *call, *p;
const char *last_system = NULL;
+ bool first = false;
int last_i;
int i;
@@ -2317,15 +2318,28 @@ void trace_event_enum_update(struct trace_enum_map **map, int len)
list_for_each_entry_safe(call, p, &ftrace_events, list) {
/* events are usually grouped together with systems */
if (!last_system || call->class->system != last_system) {
+ first = true;
last_i = 0;
last_system = call->class->system;
}
+ /*
+ * Since calls are grouped by systems, the likelyhood that the
+ * next call in the iteration belongs to the same system as the
+ * previous call is high. As an optimization, we skip seaching
+ * for a map[] that matches the call's system if the last call
+ * was from the same system. That's what last_i is for. If the
+ * call has the same system as the previous call, then last_i
+ * will be the index of the first map[] that has a matching
+ * system.
+ */
for (i = last_i; i < len; i++) {
if (call->class->system == map[i]->system) {
/* Save the first system if need be */
- if (!last_i)
+ if (first) {
last_i = i;
+ first = false;
+ }
update_event_printk(call, map[i]);
}
}