[PATCH 15/15] small_traces: Remove 8 bytes from trace_entry.
From: David Sharp
Date: Fri Dec 03 2010 - 19:15:20 EST
Remove flags, preempt_count, and lock_depth from trace_entry. These fields
were used only by the latency tracer output and are relatively unimportant,
while incurring high payload overhead.
Shrink pid to 16 bits. pid_max is usually 32768. The potential for loss of
fidelity here is minimal, and can be guaranteed by setting pid_max.
Google-Bug-Id: 3224547
Signed-off-by: David Sharp <dhsharp@xxxxxxxxxx>
---
include/linux/ftrace_event.h | 4 ++++
kernel/trace/trace.c | 7 ++++++-
kernel/trace/trace_events.c | 4 ++++
3 files changed, 14 insertions(+), 1 deletions(-)
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index 8beabb9..3a0bdd1 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -34,10 +34,14 @@ const char *ftrace_print_hex_seq(struct trace_seq *p,
*/
struct trace_entry {
unsigned short type;
+#ifdef CONFIG_SMALL_TRACES
+ short pid;
+#else
unsigned char flags;
unsigned char preempt_count;
int pid;
int lock_depth;
+#endif
};
#define FTRACE_MAX_EVENT \
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 177d4e5..73b6482 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -1101,8 +1101,11 @@ tracing_generic_entry_update(struct trace_entry *entry, unsigned long flags,
{
struct task_struct *tsk = current;
- entry->preempt_count = pc & 0xff;
+#ifdef CONFIG_SMALL_TRACES
+ entry->pid = (tsk) ? (typeof(entry->pid))tsk->pid : 0;
+#else
entry->pid = (tsk) ? tsk->pid : 0;
+ entry->preempt_count = pc & 0xff;
entry->lock_depth = (tsk) ? tsk->lock_depth : 0;
entry->flags =
#ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT
@@ -1113,9 +1116,11 @@ tracing_generic_entry_update(struct trace_entry *entry, unsigned long flags,
((pc & HARDIRQ_MASK) ? TRACE_FLAG_HARDIRQ : 0) |
((pc & SOFTIRQ_MASK) ? TRACE_FLAG_SOFTIRQ : 0) |
(need_resched() ? TRACE_FLAG_NEED_RESCHED : 0);
+#endif
}
EXPORT_SYMBOL_GPL(tracing_generic_entry_update);
+
struct ring_buffer_event *
trace_buffer_lock_reserve(struct ring_buffer *buffer,
int type,
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index 0725eea..3684a3e 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -107,10 +107,14 @@ static int trace_define_common_fields(void)
struct trace_entry ent;
__common_field(unsigned short, type);
+#ifdef CONFIG_SMALL_TRACES
+ __common_field(short, pid);
+#else
__common_field(unsigned char, flags);
__common_field(unsigned char, preempt_count);
__common_field(int, pid);
__common_field(int, lock_depth);
+#endif
return ret;
}
--
1.7.3.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/