Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 285062
b: refs/heads/master
c: 6895061
h: refs/heads/master
v: v3
  • Loading branch information
Steven Rostedt authored and Steven Rostedt committed Dec 21, 2011
1 parent 546d0ac commit 9bb4418
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 85ae32ae019bc1c2cc22e5f51fe0c9f2812ef68c
refs/heads/master: 68950619f8c82e468d8976130462617abea605a8
29 changes: 29 additions & 0 deletions trunk/kernel/trace/ftrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <linux/sysctl.h>
#include <linux/slab.h>
#include <linux/ctype.h>
#include <linux/sort.h>
#include <linux/list.h>
#include <linux/hash.h>
#include <linux/rcupdate.h>
Expand Down Expand Up @@ -3575,6 +3576,29 @@ static __init int ftrace_init_dyn_debugfs(struct dentry *d_tracer)
return 0;
}

static void ftrace_swap_recs(void *a, void *b, int size)
{
struct dyn_ftrace *reca = a;
struct dyn_ftrace *recb = b;
struct dyn_ftrace t;

t = *reca;
*reca = *recb;
*recb = t;
}

static int ftrace_cmp_recs(const void *a, const void *b)
{
const struct dyn_ftrace *reca = a;
const struct dyn_ftrace *recb = b;

if (reca->ip > recb->ip)
return 1;
if (reca->ip < recb->ip)
return -1;
return 0;
}

static int ftrace_process_locs(struct module *mod,
unsigned long *start,
unsigned long *end)
Expand Down Expand Up @@ -3638,6 +3662,11 @@ 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 9bb4418

Please sign in to comment.