tracing: Change event->profile_count to be int type
Like total_profile_count, struct ftrace_event_call::profile_count is protected by event_mutex, so it doesn't need to be atomic_t. Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> Acked-by: Steven Rostedt <rostedt@goodmis.org> Cc: Jason Baron <jbaron@redhat.com> Cc: Masami Hiramatsu <mhiramat@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> LKML-Reference: <4B1DC549.5010705@cn.fujitsu.com> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
This commit is contained in:
committed by
Frederic Weisbecker
parent
8d18eaaff5
commit
e00bf2ec60
@@ -131,7 +131,7 @@ struct ftrace_event_call {
|
|||||||
void *mod;
|
void *mod;
|
||||||
void *data;
|
void *data;
|
||||||
|
|
||||||
atomic_t profile_count;
|
int profile_count;
|
||||||
int (*profile_enable)(struct ftrace_event_call *);
|
int (*profile_enable)(struct ftrace_event_call *);
|
||||||
void (*profile_disable)(struct ftrace_event_call *);
|
void (*profile_disable)(struct ftrace_event_call *);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -102,12 +102,10 @@ struct perf_event_attr;
|
|||||||
#ifdef CONFIG_EVENT_PROFILE
|
#ifdef CONFIG_EVENT_PROFILE
|
||||||
|
|
||||||
#define TRACE_SYS_ENTER_PROFILE_INIT(sname) \
|
#define TRACE_SYS_ENTER_PROFILE_INIT(sname) \
|
||||||
.profile_count = ATOMIC_INIT(-1), \
|
|
||||||
.profile_enable = prof_sysenter_enable, \
|
.profile_enable = prof_sysenter_enable, \
|
||||||
.profile_disable = prof_sysenter_disable,
|
.profile_disable = prof_sysenter_disable,
|
||||||
|
|
||||||
#define TRACE_SYS_EXIT_PROFILE_INIT(sname) \
|
#define TRACE_SYS_EXIT_PROFILE_INIT(sname) \
|
||||||
.profile_count = ATOMIC_INIT(-1), \
|
|
||||||
.profile_enable = prof_sysexit_enable, \
|
.profile_enable = prof_sysexit_enable, \
|
||||||
.profile_disable = prof_sysexit_disable,
|
.profile_disable = prof_sysexit_disable,
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -629,7 +629,6 @@ static void ftrace_profile_disable_##name(struct ftrace_event_call *unused)\
|
|||||||
#ifdef CONFIG_EVENT_PROFILE
|
#ifdef CONFIG_EVENT_PROFILE
|
||||||
|
|
||||||
#define _TRACE_PROFILE_INIT(call) \
|
#define _TRACE_PROFILE_INIT(call) \
|
||||||
.profile_count = ATOMIC_INIT(-1), \
|
|
||||||
.profile_enable = ftrace_profile_enable_##call, \
|
.profile_enable = ftrace_profile_enable_##call, \
|
||||||
.profile_disable = ftrace_profile_disable_##call,
|
.profile_disable = ftrace_profile_disable_##call,
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ static int ftrace_profile_enable_event(struct ftrace_event_call *event)
|
|||||||
char *buf;
|
char *buf;
|
||||||
int ret = -ENOMEM;
|
int ret = -ENOMEM;
|
||||||
|
|
||||||
if (atomic_inc_return(&event->profile_count))
|
if (event->profile_count++ > 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!total_profile_count) {
|
if (!total_profile_count) {
|
||||||
@@ -56,7 +56,7 @@ fail_buf_nmi:
|
|||||||
perf_trace_buf = NULL;
|
perf_trace_buf = NULL;
|
||||||
}
|
}
|
||||||
fail_buf:
|
fail_buf:
|
||||||
atomic_dec(&event->profile_count);
|
event->profile_count--;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -83,7 +83,7 @@ static void ftrace_profile_disable_event(struct ftrace_event_call *event)
|
|||||||
{
|
{
|
||||||
char *buf, *nmi_buf;
|
char *buf, *nmi_buf;
|
||||||
|
|
||||||
if (!atomic_add_negative(-1, &event->profile_count))
|
if (--event->profile_count > 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
event->profile_disable(event);
|
event->profile_disable(event);
|
||||||
|
|||||||
@@ -1426,7 +1426,6 @@ static int register_probe_event(struct trace_probe *tp)
|
|||||||
call->unregfunc = probe_event_disable;
|
call->unregfunc = probe_event_disable;
|
||||||
|
|
||||||
#ifdef CONFIG_EVENT_PROFILE
|
#ifdef CONFIG_EVENT_PROFILE
|
||||||
atomic_set(&call->profile_count, -1);
|
|
||||||
call->profile_enable = probe_profile_enable;
|
call->profile_enable = probe_profile_enable;
|
||||||
call->profile_disable = probe_profile_disable;
|
call->profile_disable = probe_profile_disable;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user