Commit 92edca07 authored by Steven Rostedt's avatar Steven Rostedt Committed by Steven Rostedt

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: default avatarSteven Rostedt <rostedt@goodmis.org>
parent d1a29143
...@@ -887,8 +887,8 @@ enum { ...@@ -887,8 +887,8 @@ enum {
struct ftrace_event_field { struct ftrace_event_field {
struct list_head link; struct list_head link;
char *name; const char *name;
char *type; const char *type;
int filter_type; int filter_type;
int offset; int offset;
int size; int size;
......
...@@ -72,13 +72,8 @@ static int __trace_define_field(struct list_head *head, const char *type, ...@@ -72,13 +72,8 @@ static int __trace_define_field(struct list_head *head, const char *type,
if (!field) if (!field)
goto err; goto err;
field->name = kstrdup(name, GFP_KERNEL); field->name = name;
if (!field->name) field->type = type;
goto err;
field->type = kstrdup(type, GFP_KERNEL);
if (!field->type)
goto err;
if (filter_type == FILTER_OTHER) if (filter_type == FILTER_OTHER)
field->filter_type = filter_assign_type(type); field->filter_type = filter_assign_type(type);
...@@ -94,8 +89,6 @@ static int __trace_define_field(struct list_head *head, const char *type, ...@@ -94,8 +89,6 @@ static int __trace_define_field(struct list_head *head, const char *type,
return 0; return 0;
err: err:
if (field)
kfree(field->name);
kmem_cache_free(field_cachep, field); kmem_cache_free(field_cachep, field);
return -ENOMEM; return -ENOMEM;
...@@ -146,8 +139,6 @@ void trace_destroy_fields(struct ftrace_event_call *call) ...@@ -146,8 +139,6 @@ void trace_destroy_fields(struct ftrace_event_call *call)
head = trace_get_fields(call); head = trace_get_fields(call);
list_for_each_entry_safe(field, next, head, link) { list_for_each_entry_safe(field, next, head, link) {
list_del(&field->link); list_del(&field->link);
kfree(field->type);
kfree(field->name);
kmem_cache_free(field_cachep, field); kmem_cache_free(field_cachep, field);
} }
} }
...@@ -286,7 +277,6 @@ static void __put_system(struct event_subsystem *system) ...@@ -286,7 +277,6 @@ static void __put_system(struct event_subsystem *system)
kfree(filter->filter_string); kfree(filter->filter_string);
kfree(filter); kfree(filter);
} }
kfree(system->name);
kfree(system); kfree(system);
} }
...@@ -1202,10 +1192,7 @@ create_new_subsystem(const char *name) ...@@ -1202,10 +1192,7 @@ create_new_subsystem(const char *name)
return NULL; return NULL;
system->ref_count = 1; system->ref_count = 1;
system->name = kstrdup(name, GFP_KERNEL); system->name = name;
if (!system->name)
goto out_free;
system->filter = NULL; system->filter = NULL;
...@@ -1218,7 +1205,6 @@ create_new_subsystem(const char *name) ...@@ -1218,7 +1205,6 @@ create_new_subsystem(const char *name)
return system; return system;
out_free: out_free:
kfree(system->name);
kfree(system); kfree(system);
return NULL; return NULL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment