]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
tracing: use union for multi-usages field
authorLai Jiangshan <laijs@cn.fujitsu.com>
Tue, 24 Mar 2009 05:38:06 +0000 (13:38 +0800)
committerIngo Molnar <mingo@elte.hu>
Tue, 24 Mar 2009 15:43:12 +0000 (16:43 +0100)
Impact: cleanup

struct dyn_ftrace::ip has different usages in his lifecycle,
we use union for it. And also for struct dyn_ftrace::flags.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: Steven Rostedt <srostedt@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <49C871BE.3080405@cn.fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
include/linux/ftrace.h
kernel/trace/ftrace.c

index 1141248c84ee07afd1cc94c782051832898aaeff..015a3d22cf7434deb500233623ae14b778d05e5b 100644 (file)
@@ -145,9 +145,15 @@ enum {
 };
 
 struct dyn_ftrace {
-       unsigned long           ip; /* address of mcount call-site */
-       unsigned long           flags;
-       struct dyn_arch_ftrace  arch;
+       union {
+               unsigned long           ip; /* address of mcount call-site */
+               struct dyn_ftrace       *freelist;
+       };
+       union {
+               unsigned long           flags;
+               struct dyn_ftrace       *newlist;
+       };
+       struct dyn_arch_ftrace          arch;
 };
 
 int ftrace_force_update(void);
index bb377112b1bb42a81d425e5c5f1736a5772cfe28..7b8722baf1531b3f82df2dde923d343332bd7d6e 100644 (file)
@@ -341,7 +341,7 @@ static inline int record_frozen(struct dyn_ftrace *rec)
 
 static void ftrace_free_rec(struct dyn_ftrace *rec)
 {
-       rec->ip = (unsigned long)ftrace_free_records;
+       rec->freelist = ftrace_free_records;
        ftrace_free_records = rec;
        rec->flags |= FTRACE_FL_FREE;
 }
@@ -379,7 +379,7 @@ static struct dyn_ftrace *ftrace_alloc_dyn_node(unsigned long ip)
                        return NULL;
                }
 
-               ftrace_free_records = (void *)rec->ip;
+               ftrace_free_records = rec->freelist;
                memset(rec, 0, sizeof(*rec));
                return rec;
        }
@@ -411,7 +411,7 @@ ftrace_record_ip(unsigned long ip)
                return NULL;
 
        rec->ip = ip;
-       rec->flags = (unsigned long)ftrace_new_addrs;
+       rec->newlist = ftrace_new_addrs;
        ftrace_new_addrs = rec;
 
        return rec;
@@ -731,7 +731,7 @@ static int ftrace_update_code(struct module *mod)
                        return -1;
 
                p = ftrace_new_addrs;
-               ftrace_new_addrs = (struct dyn_ftrace *)p->flags;
+               ftrace_new_addrs = p->newlist;
                p->flags = 0L;
 
                /* convert record (i.e, patch mcount-call with NOP) */