Skip to contentSkip to conversation

ftrace: Do not copy old hash when resetting.

PATCH New Wang Nan 1 participant 1 message Jul 15, 2014

Subsystems (2)
lore
Share & tools
lore

Wang Nan

author
#0 lore raw

PATCH v2 1/1 ftrace: Do not copy old hash when resetting.

If we are going to reset hash, we don't need to duplicate old hash and remove every entries right after allocation.

Change from v1:
- if statement is swapped to make condition positive.

Cc Steven Rostedt <[email protected]>
Cc Ingo Molnar <[email protected]>
---
 kernel/trace/ftrace.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
kernel/trace/ftrace.c +5 -3
index 5b372e3..aa61d01 100644
@@ -3471,14 +3471,16 @@ ftrace_set_hash(struct ftrace_ops *ops, unsigned char *buf, int len,
 	else
 		orig_hash = &ops->notrace_hash;
 
-	hash = alloc_and_copy_ftrace_hash(FTRACE_HASH_DEFAULT_BITS, *orig_hash);
+	if (reset)
+		hash = alloc_ftrace_hash(FTRACE_HASH_DEFAULT_BITS);
+	else
+		hash = alloc_and_copy_ftrace_hash(FTRACE_HASH_DEFAULT_BITS, *orig_hash);
+
 	if (!hash) {
 		ret = -ENOMEM;
 		goto out_regex_unlock;
 	}
 
-	if (reset)
-		ftrace_filter_reset(hash);
 	if (buf && !ftrace_match_records(hash, buf, len)) {
 		ret = -EINVAL;
 		goto out_regex_unlock;
Signature · 1 line
1.8.4