Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 285063
b: refs/heads/master
c: 5855fea
h: refs/heads/master
i:
  285061: 546d0ac
  285059: 68914b3
  285055: cb71898
v: v3
  • Loading branch information
Steven Rostedt authored and Steven Rostedt committed Dec 21, 2011
1 parent 9bb4418 commit ee47664
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 16 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: 68950619f8c82e468d8976130462617abea605a8
refs/heads/master: 5855fead9cc358adebd6bdeec202d040c623ae38
38 changes: 23 additions & 15 deletions trunk/kernel/trace/ftrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <linux/hardirq.h>
#include <linux/kthread.h>
#include <linux/uaccess.h>
#include <linux/bsearch.h>
#include <linux/module.h>
#include <linux/ftrace.h>
#include <linux/sysctl.h>
Expand Down Expand Up @@ -1300,6 +1301,19 @@ ftrace_ops_test(struct ftrace_ops *ops, unsigned long ip)
} \
}


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;
}

/**
* ftrace_location - return true if the ip giving is a traced location
* @ip: the instruction pointer to check
Expand All @@ -1313,11 +1327,17 @@ int ftrace_location(unsigned long ip)
{
struct ftrace_page *pg;
struct dyn_ftrace *rec;
struct dyn_ftrace key;

do_for_each_ftrace_rec(pg, rec) {
if (rec->ip == ip)
key.ip = ip;

for (pg = ftrace_pages_start; pg; pg = pg->next) {
rec = bsearch(&key, pg->records, pg->index,
sizeof(struct dyn_ftrace),
ftrace_cmp_recs);
if (rec)
return 1;
} while_for_each_ftrace_rec();
}

return 0;
}
Expand Down Expand Up @@ -3587,18 +3607,6 @@ static void ftrace_swap_recs(void *a, void *b, int size)
*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

0 comments on commit ee47664

Please sign in to comment.