diff options
author | Namhyung Kim <namhyung.kim@lge.com> | 2013-04-09 19:55:50 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2013-04-12 23:02:33 -0400 |
commit | 20079ebe73c16b34621abd2993f3d48e2f9336b7 (patch) | |
tree | 96b2ace696902e848edd01173505fddba44a743e /kernel/trace | |
parent | ed6f1c996bfe4b6e520cf7a74b51cd6988d84420 (diff) |
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>
Diffstat (limited to 'kernel/trace')
-rw-r--r-- | kernel/trace/ftrace.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 3b84fc100788..9b44abb2c5a0 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
@@ -486,7 +486,6 @@ struct ftrace_profile_stat { | |||
486 | #define PROFILES_PER_PAGE \ | 486 | #define PROFILES_PER_PAGE \ |
487 | (PROFILE_RECORDS_SIZE / sizeof(struct ftrace_profile)) | 487 | (PROFILE_RECORDS_SIZE / sizeof(struct ftrace_profile)) |
488 | 488 | ||
489 | static int ftrace_profile_bits __read_mostly; | ||
490 | static int ftrace_profile_enabled __read_mostly; | 489 | static int ftrace_profile_enabled __read_mostly; |
491 | 490 | ||
492 | /* ftrace_profile_lock - synchronize the enable and disable of the profiler */ | 491 | /* ftrace_profile_lock - synchronize the enable and disable of the profiler */ |
@@ -494,7 +493,8 @@ static DEFINE_MUTEX(ftrace_profile_lock); | |||
494 | 493 | ||
495 | static DEFINE_PER_CPU(struct ftrace_profile_stat, ftrace_profile_stats); | 494 | static DEFINE_PER_CPU(struct ftrace_profile_stat, ftrace_profile_stats); |
496 | 495 | ||
497 | #define FTRACE_PROFILE_HASH_SIZE 1024 /* must be power of 2 */ | 496 | #define FTRACE_PROFILE_HASH_BITS 10 |
497 | #define FTRACE_PROFILE_HASH_SIZE (1 << FTRACE_PROFILE_HASH_BITS) | ||
498 | 498 | ||
499 | static void * | 499 | static void * |
500 | function_stat_next(void *v, int idx) | 500 | function_stat_next(void *v, int idx) |
@@ -725,13 +725,6 @@ static int ftrace_profile_init_cpu(int cpu) | |||
725 | if (!stat->hash) | 725 | if (!stat->hash) |
726 | return -ENOMEM; | 726 | return -ENOMEM; |
727 | 727 | ||
728 | if (!ftrace_profile_bits) { | ||
729 | size--; | ||
730 | |||
731 | for (; size; size >>= 1) | ||
732 | ftrace_profile_bits++; | ||
733 | } | ||
734 | |||
735 | /* Preallocate the function profiling pages */ | 728 | /* Preallocate the function profiling pages */ |
736 | if (ftrace_profile_pages_init(stat) < 0) { | 729 | if (ftrace_profile_pages_init(stat) < 0) { |
737 | kfree(stat->hash); | 730 | kfree(stat->hash); |
@@ -765,7 +758,7 @@ ftrace_find_profiled_func(struct ftrace_profile_stat *stat, unsigned long ip) | |||
765 | struct hlist_node *n; | 758 | struct hlist_node *n; |
766 | unsigned long key; | 759 | unsigned long key; |
767 | 760 | ||
768 | key = hash_long(ip, ftrace_profile_bits); | 761 | key = hash_long(ip, FTRACE_PROFILE_HASH_BITS); |
769 | hhd = &stat->hash[key]; | 762 | hhd = &stat->hash[key]; |
770 | 763 | ||
771 | if (hlist_empty(hhd)) | 764 | if (hlist_empty(hhd)) |
@@ -784,7 +777,7 @@ static void ftrace_add_profile(struct ftrace_profile_stat *stat, | |||
784 | { | 777 | { |
785 | unsigned long key; | 778 | unsigned long key; |
786 | 779 | ||
787 | key = hash_long(rec->ip, ftrace_profile_bits); | 780 | key = hash_long(rec->ip, FTRACE_PROFILE_HASH_BITS); |
788 | hlist_add_head_rcu(&rec->node, &stat->hash[key]); | 781 | hlist_add_head_rcu(&rec->node, &stat->hash[key]); |
789 | } | 782 | } |
790 | 783 | ||