tracing: move tgid out of generic entry and into userstack
authorSteven Rostedt <srostedt@redhat.com>
Fri, 11 Sep 2009 15:36:23 +0000 (11:36 -0400)
committerSteven Rostedt <rostedt@goodmis.org>
Fri, 11 Sep 2009 15:36:23 +0000 (11:36 -0400)
The userstack trace required the recording of the tgid entry.
Unfortunately, it was added to the generic entry where it wasted
4 bytes of every entry and was only used by one entry.

This patch moves it out of the generic field and moves it into the
only user (userstack_entry).

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
include/linux/ftrace_event.h
kernel/trace/trace.c
kernel/trace/trace.h
kernel/trace/trace_events.c
kernel/trace/trace_output.c

index 23f7179bf74eb53d9def4ade7f1c2114d7b1017f..06c795b536c2b20db94a46de33e5834462a897d5 100644 (file)
@@ -34,7 +34,6 @@ struct trace_entry {
        unsigned char           flags;
        unsigned char           preempt_count;
        int                     pid;
-       int                     tgid;
 };
 
 #define FTRACE_MAX_EVENT                                               \
index 5c75deeefe30e7b3c9c6b36c18caf15438f67683..1a37da2e8534ad9d2c88afc41b5dfaa69580b03b 100644 (file)
@@ -886,7 +886,6 @@ tracing_generic_entry_update(struct trace_entry *entry, unsigned long flags,
 
        entry->preempt_count            = pc & 0xff;
        entry->pid                      = (tsk) ? tsk->pid : 0;
-       entry->tgid                     = (tsk) ? tsk->tgid : 0;
        entry->flags =
 #ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT
                (irqs_disabled_flags(flags) ? TRACE_FLAG_IRQS_OFF : 0) |
@@ -1068,6 +1067,7 @@ ftrace_trace_userstack(struct ring_buffer *buffer, unsigned long flags, int pc)
                return;
        entry   = ring_buffer_event_data(event);
 
+       entry->tgid             = current->tgid;
        memset(&entry->caller, 0, sizeof(entry->caller));
 
        trace.nr_entries        = 0;
index acaa68060ebcae874b3533f4eb47deaa17ea1755..b69697b4b846f8043241309a8a925c220c079887 100644 (file)
@@ -101,6 +101,7 @@ struct stack_entry {
 
 struct userstack_entry {
        struct trace_entry      ent;
+       unsigned int            tgid;
        unsigned long           caller[FTRACE_STACK_ENTRIES];
 };
 
index 78b1ed230177246349d10ba83615b99f3adcbde3..28d92027a93c0d88ebcd5afd03eeb8fbe11bf593 100644 (file)
@@ -86,7 +86,6 @@ int trace_define_common_fields(struct ftrace_event_call *call)
        __common_field(unsigned char, flags);
        __common_field(unsigned char, preempt_count);
        __common_field(int, pid);
-       __common_field(int, tgid);
 
        return ret;
 }
@@ -572,13 +571,11 @@ static int trace_write_header(struct trace_seq *s)
                                "\tfield:%s %s;\toffset:%zu;\tsize:%zu;\n"
                                "\tfield:%s %s;\toffset:%zu;\tsize:%zu;\n"
                                "\tfield:%s %s;\toffset:%zu;\tsize:%zu;\n"
-                               "\tfield:%s %s;\toffset:%zu;\tsize:%zu;\n"
                                "\n",
                                FIELD(unsigned short, type),
                                FIELD(unsigned char, flags),
                                FIELD(unsigned char, preempt_count),
-                               FIELD(int, pid),
-                               FIELD(int, tgid));
+                               FIELD(int, pid));
 }
 
 static ssize_t
index e0c2545622e8f7617b3e32bcb8c3df235aa3a929..be34a6aa7e4d7fb181108d6ee85774561fe1ba00 100644 (file)
@@ -407,7 +407,7 @@ seq_print_userip_objs(const struct userstack_entry *entry, struct trace_seq *s,
                 * since individual threads might have already quit!
                 */
                rcu_read_lock();
-               task = find_task_by_vpid(entry->ent.tgid);
+               task = find_task_by_vpid(entry->tgid);
                if (task)
                        mm = get_task_mm(task);
                rcu_read_unlock();