Skip to content

Commit 4046bf0

Browse files
namhyungrostedt
authored andcommitted
ftrace: Expose ftrace_hash_empty and ftrace_lookup_ip
It will be used when checking graph filter hashes later. Link: http://lkml.kernel.org/r/20170120024447.26097-2-namhyung@kernel.org Signed-off-by: Namhyung Kim <namhyung@kernel.org> [ Moved ftrace_hash dec and functions outside of FUNCTION_GRAPH define ] Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
1 parent 3e278c0 commit 4046bf0

2 files changed

Lines changed: 16 additions & 14 deletions

File tree

‎kernel/trace/ftrace.c‎

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,13 +1110,6 @@ struct ftrace_func_entry {
11101110
unsigned long ip;
11111111
};
11121112

1113-
struct ftrace_hash {
1114-
unsigned long size_bits;
1115-
struct hlist_head *buckets;
1116-
unsigned long count;
1117-
struct rcu_head rcu;
1118-
};
1119-
11201113
/*
11211114
* We make these constant because no one should touch them,
11221115
* but they are used as the default "empty hash", to avoid allocating
@@ -1192,12 +1185,7 @@ struct ftrace_page {
11921185
static struct ftrace_page *ftrace_pages_start;
11931186
static struct ftrace_page *ftrace_pages;
11941187

1195-
static bool __always_inline ftrace_hash_empty(struct ftrace_hash *hash)
1196-
{
1197-
return !hash || !hash->count;
1198-
}
1199-
1200-
static struct ftrace_func_entry *
1188+
struct ftrace_func_entry *
12011189
ftrace_lookup_ip(struct ftrace_hash *hash, unsigned long ip)
12021190
{
12031191
unsigned long key;

‎kernel/trace/trace.h‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,21 @@ enum print_line_t print_trace_line(struct trace_iterator *iter);
753753

754754
extern char trace_find_mark(unsigned long long duration);
755755

756+
struct ftrace_hash {
757+
unsigned long size_bits;
758+
struct hlist_head *buckets;
759+
unsigned long count;
760+
struct rcu_head rcu;
761+
};
762+
763+
struct ftrace_func_entry *
764+
ftrace_lookup_ip(struct ftrace_hash *hash, unsigned long ip);
765+
766+
static bool __always_inline ftrace_hash_empty(struct ftrace_hash *hash)
767+
{
768+
return !hash || !hash->count;
769+
}
770+
756771
/* Standard output formatting function used for function return traces */
757772
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
758773

@@ -787,7 +802,6 @@ extern void __trace_graph_return(struct trace_array *tr,
787802
struct ftrace_graph_ret *trace,
788803
unsigned long flags, int pc);
789804

790-
791805
#ifdef CONFIG_DYNAMIC_FTRACE
792806
/* TODO: make this variable */
793807
#define FTRACE_GRAPH_MAX_FUNCS 32

0 commit comments

Comments
 (0)