diff options
author | Steven Rostedt <srostedt@redhat.com> | 2013-02-27 20:41:37 -0500 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2013-03-15 00:34:47 -0400 |
commit | 92edca073c374f66b8eee20ec6426fb0cdb6c4d5 (patch) | |
tree | 1422d988954e16eae32003738b532e8ec8db9051 /kernel/trace/trace_events.c | |
parent | d1a291437f75f6c841819b7855d95a21958cc822 (diff) |
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.c | 20 |
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, | |||
72 | if (!field) | 72 | if (!field) |
73 | goto err; | 73 | goto err; |
74 | 74 | ||
75 | field->name = kstrdup(name, GFP_KERNEL); | 75 | field->name = name; |
76 | if (!field->name) | 76 | field->type = type; |
77 | goto err; | ||
78 | |||
79 | field->type = kstrdup(type, GFP_KERNEL); | ||
80 | if (!field->type) | ||
81 | goto err; | ||
82 | 77 | ||
83 | if (filter_type == FILTER_OTHER) | 78 | if (filter_type == FILTER_OTHER) |
84 | field->filter_type = filter_assign_type(type); | 79 | field->filter_type = filter_assign_type(type); |
@@ -94,8 +89,6 @@ static int __trace_define_field(struct list_head *head, const char *type, | |||
94 | return 0; | 89 | return 0; |
95 | 90 | ||
96 | err: | 91 | err: |
97 | if (field) | ||
98 | kfree(field->name); | ||
99 | kmem_cache_free(field_cachep, field); | 92 | kmem_cache_free(field_cachep, field); |
100 | 93 | ||
101 | return -ENOMEM; | 94 | return -ENOMEM; |
@@ -146,8 +139,6 @@ void trace_destroy_fields(struct ftrace_event_call *call) | |||
146 | head = trace_get_fields(call); | 139 | head = trace_get_fields(call); |
147 | list_for_each_entry_safe(field, next, head, link) { | 140 | list_for_each_entry_safe(field, next, head, link) { |
148 | list_del(&field->link); | 141 | list_del(&field->link); |
149 | kfree(field->type); | ||
150 | kfree(field->name); | ||
151 | kmem_cache_free(field_cachep, field); | 142 | kmem_cache_free(field_cachep, field); |
152 | } | 143 | } |
153 | } | 144 | } |
@@ -286,7 +277,6 @@ static void __put_system(struct event_subsystem *system) | |||
286 | kfree(filter->filter_string); | 277 | kfree(filter->filter_string); |
287 | kfree(filter); | 278 | kfree(filter); |
288 | } | 279 | } |
289 | kfree(system->name); | ||
290 | kfree(system); | 280 | kfree(system); |
291 | } | 281 | } |
292 | 282 | ||
@@ -1202,10 +1192,7 @@ create_new_subsystem(const char *name) | |||
1202 | return NULL; | 1192 | return NULL; |
1203 | 1193 | ||
1204 | system->ref_count = 1; | 1194 | system->ref_count = 1; |
1205 | system->name = kstrdup(name, GFP_KERNEL); | 1195 | system->name = name; |
1206 | |||
1207 | if (!system->name) | ||
1208 | goto out_free; | ||
1209 | 1196 | ||
1210 | system->filter = NULL; | 1197 | system->filter = NULL; |
1211 | 1198 | ||
@@ -1218,7 +1205,6 @@ create_new_subsystem(const char *name) | |||
1218 | return system; | 1205 | return system; |
1219 | 1206 | ||
1220 | out_free: | 1207 | out_free: |
1221 | kfree(system->name); | ||
1222 | kfree(system); | 1208 | kfree(system); |
1223 | return NULL; | 1209 | return NULL; |
1224 | } | 1210 | } |