aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorWang Nan <wangnan0@huawei.com>2014-07-14 20:40:20 -0400
committerSteven Rostedt <rostedt@goodmis.org>2014-07-18 17:47:04 -0400
commitb972cc58ced01ba2cf1f67b36bcfbb3ed4fa706e (patch)
tree7821d8641b223789af28963090ab9d6f7a0d377d /kernel
parent6508fa761c330a1d2b4ae36199d08dbcb70e3ddb (diff)
ftrace: Do not copy old hash when resetting
Do not waste time copying the old hash if the hash is going to be reset. Just allocate a new hash and free the old one, as that is the same result as copying te old one and then resetting it. Link: http://lkml.kernel.org/p/1405384820-48837-1-git-send-email-wangnan0@huawei.com Signed-off-by: Wang Nan <wangnan0@huawei.com> [ SDR: Removed unused ftrace_filter_reset() function ] Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/trace/ftrace.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 4c61f28a08e0..762806026561 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -2949,13 +2949,6 @@ ftrace_enabled_open(struct inode *inode, struct file *file)
2949 return iter ? 0 : -ENOMEM; 2949 return iter ? 0 : -ENOMEM;
2950} 2950}
2951 2951
2952static void ftrace_filter_reset(struct ftrace_hash *hash)
2953{
2954 mutex_lock(&ftrace_lock);
2955 ftrace_hash_clear(hash);
2956 mutex_unlock(&ftrace_lock);
2957}
2958
2959/** 2952/**
2960 * ftrace_regex_open - initialize function tracer filter files 2953 * ftrace_regex_open - initialize function tracer filter files
2961 * @ops: The ftrace_ops that hold the hash filters 2954 * @ops: The ftrace_ops that hold the hash filters
@@ -3720,14 +3713,16 @@ ftrace_set_hash(struct ftrace_ops *ops, unsigned char *buf, int len,
3720 else 3713 else
3721 orig_hash = &ops->notrace_hash; 3714 orig_hash = &ops->notrace_hash;
3722 3715
3723 hash = alloc_and_copy_ftrace_hash(FTRACE_HASH_DEFAULT_BITS, *orig_hash); 3716 if (reset)
3717 hash = alloc_ftrace_hash(FTRACE_HASH_DEFAULT_BITS);
3718 else
3719 hash = alloc_and_copy_ftrace_hash(FTRACE_HASH_DEFAULT_BITS, *orig_hash);
3720
3724 if (!hash) { 3721 if (!hash) {
3725 ret = -ENOMEM; 3722 ret = -ENOMEM;
3726 goto out_regex_unlock; 3723 goto out_regex_unlock;
3727 } 3724 }
3728 3725
3729 if (reset)
3730 ftrace_filter_reset(hash);
3731 if (buf && !ftrace_match_records(hash, buf, len)) { 3726 if (buf && !ftrace_match_records(hash, buf, len)) {
3732 ret = -EINVAL; 3727 ret = -EINVAL;
3733 goto out_regex_unlock; 3728 goto out_regex_unlock;