ftrace: Get rid of ftrace_profile_bits
It seems that function profiler's hash size is fixed at 1024. Add and use FTRACE_PROFILE_HASH_BITS instead and update hash size macro. Link: http://lkml.kernel.org/r/1365551750-4504-1-git-send-email-namhyung@kernel.org Signed-off-by: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
This commit is contained in:
parent
ed6f1c996b
commit
20079ebe73
@ -486,7 +486,6 @@ struct ftrace_profile_stat {
|
|||||||
#define PROFILES_PER_PAGE \
|
#define PROFILES_PER_PAGE \
|
||||||
(PROFILE_RECORDS_SIZE / sizeof(struct ftrace_profile))
|
(PROFILE_RECORDS_SIZE / sizeof(struct ftrace_profile))
|
||||||
|
|
||||||
static int ftrace_profile_bits __read_mostly;
|
|
||||||
static int ftrace_profile_enabled __read_mostly;
|
static int ftrace_profile_enabled __read_mostly;
|
||||||
|
|
||||||
/* ftrace_profile_lock - synchronize the enable and disable of the profiler */
|
/* ftrace_profile_lock - synchronize the enable and disable of the profiler */
|
||||||
@ -494,7 +493,8 @@ static DEFINE_MUTEX(ftrace_profile_lock);
|
|||||||
|
|
||||||
static DEFINE_PER_CPU(struct ftrace_profile_stat, ftrace_profile_stats);
|
static DEFINE_PER_CPU(struct ftrace_profile_stat, ftrace_profile_stats);
|
||||||
|
|
||||||
#define FTRACE_PROFILE_HASH_SIZE 1024 /* must be power of 2 */
|
#define FTRACE_PROFILE_HASH_BITS 10
|
||||||
|
#define FTRACE_PROFILE_HASH_SIZE (1 << FTRACE_PROFILE_HASH_BITS)
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
function_stat_next(void *v, int idx)
|
function_stat_next(void *v, int idx)
|
||||||
@ -725,13 +725,6 @@ static int ftrace_profile_init_cpu(int cpu)
|
|||||||
if (!stat->hash)
|
if (!stat->hash)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
if (!ftrace_profile_bits) {
|
|
||||||
size--;
|
|
||||||
|
|
||||||
for (; size; size >>= 1)
|
|
||||||
ftrace_profile_bits++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Preallocate the function profiling pages */
|
/* Preallocate the function profiling pages */
|
||||||
if (ftrace_profile_pages_init(stat) < 0) {
|
if (ftrace_profile_pages_init(stat) < 0) {
|
||||||
kfree(stat->hash);
|
kfree(stat->hash);
|
||||||
@ -765,7 +758,7 @@ ftrace_find_profiled_func(struct ftrace_profile_stat *stat, unsigned long ip)
|
|||||||
struct hlist_node *n;
|
struct hlist_node *n;
|
||||||
unsigned long key;
|
unsigned long key;
|
||||||
|
|
||||||
key = hash_long(ip, ftrace_profile_bits);
|
key = hash_long(ip, FTRACE_PROFILE_HASH_BITS);
|
||||||
hhd = &stat->hash[key];
|
hhd = &stat->hash[key];
|
||||||
|
|
||||||
if (hlist_empty(hhd))
|
if (hlist_empty(hhd))
|
||||||
@ -784,7 +777,7 @@ static void ftrace_add_profile(struct ftrace_profile_stat *stat,
|
|||||||
{
|
{
|
||||||
unsigned long key;
|
unsigned long key;
|
||||||
|
|
||||||
key = hash_long(rec->ip, ftrace_profile_bits);
|
key = hash_long(rec->ip, FTRACE_PROFILE_HASH_BITS);
|
||||||
hlist_add_head_rcu(&rec->node, &stat->hash[key]);
|
hlist_add_head_rcu(&rec->node, &stat->hash[key]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user