Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'tip/perf/core' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace into perf/core

Pull perf optimizations from Steve Rostedt.

Signed-off-by: Ingo Molnar <mingo@kernel.org>

+28 -27
+8 -14
include/trace/events/sched.h
··· 57 57 58 58 TP_PROTO(struct task_struct *p, int success), 59 59 60 - TP_ARGS(p, success), 60 + TP_ARGS(__perf_task(p), success), 61 61 62 62 TP_STRUCT__entry( 63 63 __array( char, comm, TASK_COMM_LEN ) ··· 73 73 __entry->prio = p->prio; 74 74 __entry->success = success; 75 75 __entry->target_cpu = task_cpu(p); 76 - ) 77 - TP_perf_assign( 78 - __perf_task(p); 79 76 ), 80 77 81 78 TP_printk("comm=%s pid=%d prio=%d success=%d target_cpu=%03d", ··· 310 313 311 314 TP_PROTO(struct task_struct *tsk, u64 delay), 312 315 313 - TP_ARGS(tsk, delay), 316 + TP_ARGS(__perf_task(tsk), __perf_count(delay)), 314 317 315 318 TP_STRUCT__entry( 316 319 __array( char, comm, TASK_COMM_LEN ) ··· 322 325 memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN); 323 326 __entry->pid = tsk->pid; 324 327 __entry->delay = delay; 325 - ) 326 - TP_perf_assign( 327 - __perf_count(delay); 328 - __perf_task(tsk); 329 328 ), 330 329 331 330 TP_printk("comm=%s pid=%d delay=%Lu [ns]", ··· 365 372 * Tracepoint for accounting runtime (time the task is executing 366 373 * on a CPU). 367 374 */ 368 - TRACE_EVENT(sched_stat_runtime, 375 + DECLARE_EVENT_CLASS(sched_stat_runtime, 369 376 370 377 TP_PROTO(struct task_struct *tsk, u64 runtime, u64 vruntime), 371 378 372 - TP_ARGS(tsk, runtime, vruntime), 379 + TP_ARGS(tsk, __perf_count(runtime), vruntime), 373 380 374 381 TP_STRUCT__entry( 375 382 __array( char, comm, TASK_COMM_LEN ) ··· 383 390 __entry->pid = tsk->pid; 384 391 __entry->runtime = runtime; 385 392 __entry->vruntime = vruntime; 386 - ) 387 - TP_perf_assign( 388 - __perf_count(runtime); 389 393 ), 390 394 391 395 TP_printk("comm=%s pid=%d runtime=%Lu [ns] vruntime=%Lu [ns]", ··· 390 400 (unsigned long long)__entry->runtime, 391 401 (unsigned long long)__entry->vruntime) 392 402 ); 403 + 404 + DEFINE_EVENT(sched_stat_runtime, sched_stat_runtime, 405 + TP_PROTO(struct task_struct *tsk, u64 runtime, u64 vruntime), 406 + TP_ARGS(tsk, runtime, vruntime)); 393 407 394 408 /* 395 409 * Tracepoint for showing priority inheritance modifying a tasks
+20 -13
include/trace/ftrace.h
··· 507 507 #undef TP_fast_assign 508 508 #define TP_fast_assign(args...) args 509 509 510 - #undef TP_perf_assign 511 - #define TP_perf_assign(args...) 510 + #undef __perf_addr 511 + #define __perf_addr(a) (a) 512 + 513 + #undef __perf_count 514 + #define __perf_count(c) (c) 515 + 516 + #undef __perf_task 517 + #define __perf_task(t) (t) 512 518 513 519 #undef DECLARE_EVENT_CLASS 514 520 #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ ··· 642 636 #define __get_str(field) (char *)__get_dynamic_array(field) 643 637 644 638 #undef __perf_addr 645 - #define __perf_addr(a) __addr = (a) 639 + #define __perf_addr(a) (__addr = (a)) 646 640 647 641 #undef __perf_count 648 - #define __perf_count(c) __count = (c) 642 + #define __perf_count(c) (__count = (c)) 649 643 650 644 #undef __perf_task 651 - #define __perf_task(t) __task = (t) 652 - 653 - #undef TP_perf_assign 654 - #define TP_perf_assign(args...) args 645 + #define __perf_task(t) (__task = (t)) 655 646 656 647 #undef DECLARE_EVENT_CLASS 657 648 #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ ··· 666 663 int __data_size; \ 667 664 int rctx; \ 668 665 \ 669 - perf_fetch_caller_regs(&__regs); \ 670 - \ 671 666 __data_size = ftrace_get_offsets_##call(&__data_offsets, args); \ 667 + \ 668 + head = this_cpu_ptr(event_call->perf_events); \ 669 + if (__builtin_constant_p(!__task) && !__task && \ 670 + hlist_empty(head)) \ 671 + return; \ 672 + \ 672 673 __entry_size = ALIGN(__data_size + sizeof(*entry) + sizeof(u32),\ 673 674 sizeof(u64)); \ 674 675 __entry_size -= sizeof(u32); \ 675 676 \ 676 - entry = (struct ftrace_raw_##call *)perf_trace_buf_prepare( \ 677 - __entry_size, event_call->event.type, &__regs, &rctx); \ 677 + perf_fetch_caller_regs(&__regs); \ 678 + entry = perf_trace_buf_prepare(__entry_size, \ 679 + event_call->event.type, &__regs, &rctx); \ 678 680 if (!entry) \ 679 681 return; \ 680 682 \ ··· 687 679 \ 688 680 { assign; } \ 689 681 \ 690 - head = this_cpu_ptr(event_call->perf_events); \ 691 682 perf_trace_buf_submit(entry, __entry_size, rctx, __addr, \ 692 683 __count, &__regs, head, __task); \ 693 684 }