Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 364912
b: refs/heads/master
c: d1a2914
h: refs/heads/master
v: v3
  • Loading branch information
Steven Rostedt authored and Steven Rostedt committed Mar 15, 2013
1 parent 8c5d257 commit d9c84ee
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 772482216f170ddc62fa92a3cc3271cdd1993525
refs/heads/master: d1a291437f75f6c841819b7855d95a21958cc822
27 changes: 20 additions & 7 deletions trunk/kernel/trace/trace_events.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ EXPORT_SYMBOL_GPL(event_storage);
LIST_HEAD(ftrace_events);
LIST_HEAD(ftrace_common_fields);

#define GFP_TRACE (GFP_KERNEL | __GFP_ZERO)

static struct kmem_cache *field_cachep;
static struct kmem_cache *file_cachep;

/* Double loops, do not use break, only goto's work */
#define do_for_each_event_file(tr, file) \
list_for_each_entry(tr, &ftrace_trace_arrays, list) { \
Expand Down Expand Up @@ -63,7 +68,7 @@ static int __trace_define_field(struct list_head *head, const char *type,
{
struct ftrace_event_field *field;

field = kzalloc(sizeof(*field), GFP_KERNEL);
field = kmem_cache_alloc(field_cachep, GFP_TRACE);
if (!field)
goto err;

Expand Down Expand Up @@ -91,7 +96,7 @@ static int __trace_define_field(struct list_head *head, const char *type,
err:
if (field)
kfree(field->name);
kfree(field);
kmem_cache_free(field_cachep, field);

return -ENOMEM;
}
Expand Down Expand Up @@ -143,7 +148,7 @@ void trace_destroy_fields(struct ftrace_event_call *call)
list_del(&field->link);
kfree(field->type);
kfree(field->name);
kfree(field);
kmem_cache_free(field_cachep, field);
}
}

Expand Down Expand Up @@ -1383,7 +1388,7 @@ static void remove_event_from_tracers(struct ftrace_event_call *call)
list_del(&file->list);
debugfs_remove_recursive(file->dir);
remove_subsystem(file->system);
kfree(file);
kmem_cache_free(file_cachep, file);

/*
* The do_for_each_event_file_safe() is
Expand Down Expand Up @@ -1462,7 +1467,7 @@ __trace_add_new_event(struct ftrace_event_call *call,
{
struct ftrace_event_file *file;

file = kzalloc(sizeof(*file), GFP_KERNEL);
file = kmem_cache_alloc(file_cachep, GFP_TRACE);
if (!file)
return -ENOMEM;

Expand All @@ -1484,7 +1489,7 @@ __trace_early_add_new_event(struct ftrace_event_call *call,
{
struct ftrace_event_file *file;

file = kzalloc(sizeof(*file), GFP_KERNEL);
file = kmem_cache_alloc(file_cachep, GFP_TRACE);
if (!file)
return -ENOMEM;

Expand Down Expand Up @@ -1791,7 +1796,7 @@ __trace_remove_event_dirs(struct trace_array *tr)
list_del(&file->list);
debugfs_remove_recursive(file->dir);
remove_subsystem(file->system);
kfree(file);
kmem_cache_free(file_cachep, file);
}
}

Expand Down Expand Up @@ -1947,6 +1952,13 @@ int event_trace_del_tracer(struct trace_array *tr)
return 0;
}

static __init int event_trace_memsetup(void)
{
field_cachep = KMEM_CACHE(ftrace_event_field, SLAB_PANIC);
file_cachep = KMEM_CACHE(ftrace_event_file, SLAB_PANIC);
return 0;
}

static __init int event_trace_enable(void)
{
struct trace_array *tr = top_trace_array();
Expand Down Expand Up @@ -2021,6 +2033,7 @@ static __init int event_trace_init(void)

return 0;
}
early_initcall(event_trace_memsetup);
core_initcall(event_trace_enable);
fs_initcall(event_trace_init);

Expand Down

0 comments on commit d9c84ee

Please sign in to comment.