projects
/
cascardo
/
linux.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge commit 'v2.6.32-rc5' into perf/probes
[cascardo/linux.git]
/
kernel
/
trace
/
trace_event_profile.c
diff --git
a/kernel/trace/trace_event_profile.c
b/kernel/trace/trace_event_profile.c
index
dd44b87
..
c9f687a
100644
(file)
--- a/
kernel/trace/trace_event_profile.c
+++ b/
kernel/trace/trace_event_profile.c
@@
-31,7
+31,7
@@
static int ftrace_profile_enable_event(struct ftrace_event_call *event)
if (atomic_inc_return(&event->profile_count))
return 0;
if (atomic_inc_return(&event->profile_count))
return 0;
- if (!total_profile_count
++
) {
+ if (!total_profile_count) {
buf = (char *)alloc_percpu(profile_buf_t);
if (!buf)
goto fail_buf;
buf = (char *)alloc_percpu(profile_buf_t);
if (!buf)
goto fail_buf;
@@
-45,15
+45,20
@@
static int ftrace_profile_enable_event(struct ftrace_event_call *event)
rcu_assign_pointer(trace_profile_buf_nmi, buf);
}
rcu_assign_pointer(trace_profile_buf_nmi, buf);
}
- ret = event->profile_enable();
- if (!ret)
+ ret = event->profile_enable(event);
+ if (!ret) {
+ total_profile_count++;
return 0;
return 0;
+ }
- kfree(trace_profile_buf_nmi);
fail_buf_nmi:
fail_buf_nmi:
- kfree(trace_profile_buf);
+ if (!total_profile_count) {
+ free_percpu(trace_profile_buf_nmi);
+ free_percpu(trace_profile_buf);
+ trace_profile_buf_nmi = NULL;
+ trace_profile_buf = NULL;
+ }
fail_buf:
fail_buf:
- total_profile_count--;
atomic_dec(&event->profile_count);
return ret;
atomic_dec(&event->profile_count);
return ret;
@@
-84,7
+89,7
@@
static void ftrace_profile_disable_event(struct ftrace_event_call *event)
if (!atomic_add_negative(-1, &event->profile_count))
return;
if (!atomic_add_negative(-1, &event->profile_count))
return;
- event->profile_disable();
+ event->profile_disable(
event
);
if (!--total_profile_count) {
buf = trace_profile_buf;
if (!--total_profile_count) {
buf = trace_profile_buf;