Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 304949
b: refs/heads/master
c: 9fd4932
h: refs/heads/master
i:
  304947: 2ca4de1
v: v3
  • Loading branch information
Steven Rostedt authored and Steven Rostedt committed May 16, 2012
1 parent 7211602 commit f263aa2
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 71babb2705e2203a64c27ede13ae3508a0d2c16c
refs/heads/master: 9fd49328fc2a1cbfea542bcbcf004b5c81dc495b
2 changes: 1 addition & 1 deletion trunk/include/asm-generic/vmlinux.lds.h
Original file line number Diff line number Diff line change
Expand Up @@ -486,8 +486,8 @@
CPU_DISCARD(init.data) \
MEM_DISCARD(init.data) \
KERNEL_CTORS() \
*(.init.rodata) \
MCOUNT_REC() \
*(.init.rodata) \
FTRACE_EVENTS() \
TRACE_SYSCALLS() \
DEV_DISCARD(init.rodata) \
Expand Down
34 changes: 22 additions & 12 deletions trunk/kernel/trace/ftrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -3666,15 +3666,27 @@ static __init int ftrace_init_dyn_debugfs(struct dentry *d_tracer)
return 0;
}

static void ftrace_swap_recs(void *a, void *b, int size)
static int ftrace_cmp_ips(const void *a, const void *b)
{
struct dyn_ftrace *reca = a;
struct dyn_ftrace *recb = b;
struct dyn_ftrace t;
const unsigned long *ipa = a;
const unsigned long *ipb = b;

t = *reca;
*reca = *recb;
*recb = t;
if (*ipa > *ipb)
return 1;
if (*ipa < *ipb)
return -1;
return 0;
}

static void ftrace_swap_ips(void *a, void *b, int size)
{
unsigned long *ipa = a;
unsigned long *ipb = b;
unsigned long t;

t = *ipa;
*ipa = *ipb;
*ipb = t;
}

static int ftrace_process_locs(struct module *mod,
Expand All @@ -3693,6 +3705,9 @@ static int ftrace_process_locs(struct module *mod,
if (!count)
return 0;

sort(start, count, sizeof(*start),
ftrace_cmp_ips, ftrace_swap_ips);

pg = ftrace_allocate_pages(count);
if (!pg)
return -ENOMEM;
Expand Down Expand Up @@ -3740,11 +3755,6 @@ static int ftrace_process_locs(struct module *mod,
/* These new locations need to be initialized */
ftrace_new_pgs = pg;

/* Make each individual set of pages sorted by ips */
for (; pg; pg = pg->next)
sort(pg->records, pg->index, sizeof(struct dyn_ftrace),
ftrace_cmp_recs, ftrace_swap_recs);

/*
* We only need to disable interrupts on start up
* because we are modifying code that an interrupt
Expand Down

0 comments on commit f263aa2

Please sign in to comment.