summaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace_events.c
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2013-02-27 20:41:37 -0500
committerSteven Rostedt <rostedt@goodmis.org>2013-03-15 00:34:47 -0400
commit92edca073c374f66b8eee20ec6426fb0cdb6c4d5 (patch)
tree1422d988954e16eae32003738b532e8ec8db9051 /kernel/trace/trace_events.c
parentd1a291437f75f6c841819b7855d95a21958cc822 (diff)
downloadlinux-92edca073c374f66b8eee20ec6426fb0cdb6c4d5.tar.bz2
tracing: Use direct field, type and system names
The names used to display the field and type in the event format files are copied, as well as the system name that is displayed. All these names are created by constant values passed in. If one of theses values were to be removed by a module, the module would also be required to remove any event it created. By using the strings directly, we can save over 100K of memory. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/trace_events.c')
-rw-r--r--kernel/trace/trace_events.c20
1 files changed, 3 insertions, 17 deletions
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index 5d8845d36fa8..63b4bdf84593 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -72,13 +72,8 @@ static int __trace_define_field(struct list_head *head, const char *type,
if (!field)
goto err;
- field->name = kstrdup(name, GFP_KERNEL);
- if (!field->name)
- goto err;
-
- field->type = kstrdup(type, GFP_KERNEL);
- if (!field->type)
- goto err;
+ field->name = name;
+ field->type = type;
if (filter_type == FILTER_OTHER)
field->filter_type = filter_assign_type(type);
@@ -94,8 +89,6 @@ static int __trace_define_field(struct list_head *head, const char *type,
return 0;
err:
- if (field)
- kfree(field->name);
kmem_cache_free(field_cachep, field);
return -ENOMEM;
@@ -146,8 +139,6 @@ void trace_destroy_fields(struct ftrace_event_call *call)
head = trace_get_fields(call);
list_for_each_entry_safe(field, next, head, link) {
list_del(&field->link);
- kfree(field->type);
- kfree(field->name);
kmem_cache_free(field_cachep, field);
}
}
@@ -286,7 +277,6 @@ static void __put_system(struct event_subsystem *system)
kfree(filter->filter_string);
kfree(filter);
}
- kfree(system->name);
kfree(system);
}
@@ -1202,10 +1192,7 @@ create_new_subsystem(const char *name)
return NULL;
system->ref_count = 1;
- system->name = kstrdup(name, GFP_KERNEL);
-
- if (!system->name)
- goto out_free;
+ system->name = name;
system->filter = NULL;
@@ -1218,7 +1205,6 @@ create_new_subsystem(const char *name)
return system;
out_free:
- kfree(system->name);
kfree(system);
return NULL;
}