diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2009-02-05 13:14:13 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-02-05 19:01:41 -0500 |
commit | 51a763dd84253bab1d0a1e68e11a7753d1b702ca (patch) | |
tree | 2cc2cf0509db480391c585786285267e360c1338 /kernel/trace/kmemtrace.c | |
parent | 0a9877514c4fed10a70720293b37213dd172ee3e (diff) |
tracing: Introduce trace_buffer_{lock_reserve,unlock_commit}
Impact: new API
These new functions do what previously was being open coded, reducing
the number of details ftrace plugin writers have to worry about.
It also standardizes the handling of stacktrace, userstacktrace and
other trace options we may introduce in the future.
With this patch, for instance, the blk tracer (and some others already
in the tree) can use the "userstacktrace" /d/tracing/trace_options
facility.
$ codiff /tmp/vmlinux.before /tmp/vmlinux.after
linux-2.6-tip/kernel/trace/trace.c:
trace_vprintk | -5
trace_graph_return | -22
trace_graph_entry | -26
trace_function | -45
__ftrace_trace_stack | -27
ftrace_trace_userstack | -29
tracing_sched_switch_trace | -66
tracing_stop | +1
trace_seq_to_user | -1
ftrace_trace_special | -63
ftrace_special | +1
tracing_sched_wakeup_trace | -70
tracing_reset_online_cpus | -1
13 functions changed, 2 bytes added, 355 bytes removed, diff: -353
linux-2.6-tip/block/blktrace.c:
__blk_add_trace | -58
1 function changed, 58 bytes removed, diff: -58
linux-2.6-tip/kernel/trace/trace.c:
trace_buffer_lock_reserve | +88
trace_buffer_unlock_commit | +86
2 functions changed, 174 bytes added, diff: +174
/tmp/vmlinux.after:
16 functions changed, 176 bytes added, 413 bytes removed, diff: -237
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Acked-by: Frédéric Weisbecker <fweisbec@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/trace/kmemtrace.c')
-rw-r--r-- | kernel/trace/kmemtrace.c | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/kernel/trace/kmemtrace.c b/kernel/trace/kmemtrace.c index 256749d1032a..ae201b3eda89 100644 --- a/kernel/trace/kmemtrace.c +++ b/kernel/trace/kmemtrace.c | |||
@@ -276,13 +276,12 @@ void kmemtrace_mark_alloc_node(enum kmemtrace_type_id type_id, | |||
276 | if (!kmem_tracing_enabled) | 276 | if (!kmem_tracing_enabled) |
277 | return; | 277 | return; |
278 | 278 | ||
279 | event = ring_buffer_lock_reserve(tr->buffer, sizeof(*entry)); | 279 | event = trace_buffer_lock_reserve(tr, TRACE_KMEM_ALLOC, |
280 | sizeof(*entry), 0, 0); | ||
280 | if (!event) | 281 | if (!event) |
281 | return; | 282 | return; |
282 | entry = ring_buffer_event_data(event); | 283 | entry = ring_buffer_event_data(event); |
283 | tracing_generic_entry_update(&entry->ent, 0, 0); | ||
284 | 284 | ||
285 | entry->ent.type = TRACE_KMEM_ALLOC; | ||
286 | entry->call_site = call_site; | 285 | entry->call_site = call_site; |
287 | entry->ptr = ptr; | 286 | entry->ptr = ptr; |
288 | entry->bytes_req = bytes_req; | 287 | entry->bytes_req = bytes_req; |
@@ -290,9 +289,7 @@ void kmemtrace_mark_alloc_node(enum kmemtrace_type_id type_id, | |||
290 | entry->gfp_flags = gfp_flags; | 289 | entry->gfp_flags = gfp_flags; |
291 | entry->node = node; | 290 | entry->node = node; |
292 | 291 | ||
293 | ring_buffer_unlock_commit(tr->buffer, event); | 292 | trace_buffer_unlock_commit(tr, event, 0, 0); |
294 | |||
295 | trace_wake_up(); | ||
296 | } | 293 | } |
297 | EXPORT_SYMBOL(kmemtrace_mark_alloc_node); | 294 | EXPORT_SYMBOL(kmemtrace_mark_alloc_node); |
298 | 295 | ||
@@ -307,20 +304,16 @@ void kmemtrace_mark_free(enum kmemtrace_type_id type_id, | |||
307 | if (!kmem_tracing_enabled) | 304 | if (!kmem_tracing_enabled) |
308 | return; | 305 | return; |
309 | 306 | ||
310 | event = ring_buffer_lock_reserve(tr->buffer, sizeof(*entry)); | 307 | event = trace_buffer_lock_reserve(tr, TRACE_KMEM_FREE, |
308 | sizeof(*entry), 0, 0); | ||
311 | if (!event) | 309 | if (!event) |
312 | return; | 310 | return; |
313 | entry = ring_buffer_event_data(event); | 311 | entry = ring_buffer_event_data(event); |
314 | tracing_generic_entry_update(&entry->ent, 0, 0); | ||
315 | |||
316 | entry->ent.type = TRACE_KMEM_FREE; | ||
317 | entry->type_id = type_id; | 312 | entry->type_id = type_id; |
318 | entry->call_site = call_site; | 313 | entry->call_site = call_site; |
319 | entry->ptr = ptr; | 314 | entry->ptr = ptr; |
320 | 315 | ||
321 | ring_buffer_unlock_commit(tr->buffer, event); | 316 | trace_buffer_unlock_commit(tr, event, 0, 0); |
322 | |||
323 | trace_wake_up(); | ||
324 | } | 317 | } |
325 | EXPORT_SYMBOL(kmemtrace_mark_free); | 318 | EXPORT_SYMBOL(kmemtrace_mark_free); |
326 | 319 | ||