• Steven Rostedt's avatar
    ftrace: Use only the preempt version of function tracing · 897f68a4
    Steven Rostedt authored
    The function tracer had two different versions of function tracing.
    
    The disabling of irqs version and the preempt disable version.
    
    As function tracing in very intrusive and can cause nasty recursion
    issues, it has its own recursion protection. But the old method to
    do this was a flat layer. If it detected that a recursion was happening
    then it would just return without recording.
    
    This made the preempt version (much faster than the irq disabling one)
    not very useful, because if an interrupt were to occur after the
    recursion flag was set, the interrupt would not be traced at all,
    because every function that was traced would think it recursed on
    itself (due to the context it preempted setting the recursive flag).
    
    Now that we have a recursion flag for every context level, we
    no longer need to worry about that. We can disable preemption,
    set the current context recursion check bit, and go on. If an
    interrupt were to come along, it would check its own context bit
    and happily continue to trace.
    
    As the preempt version is faster than the irq disable version,
    there's no more reason to keep the preempt version around.
    And the irq disable version still had an issue with missing
    out on tracing NMI code.
    
    Remove the irq disable function tracer version and have the
    preempt disable version be the default (and only version).
    
    Before this patch we had from running:
    
     # echo function > /debug/tracing/current_tracer
     # for i in `seq 10`; do ./hackbench 50; done
    Time: 12.028
    Time: 11.945
    Time: 11.925
    Time: 11.964
    Time: 12.002
    Time: 11.910
    Time: 11.944
    Time: 11.929
    Time: 11.941
    Time: 11.924
    
    (average: 11.9512)
    
    Now we have:
    
     # echo function > /debug/tracing/current_tracer
     # for i in `seq 10`; do ./hackbench 50; done
    Time: 10.285
    Time: 10.407
    Time: 10.243
    Time: 10.372
    Time: 10.380
    Time: 10.198
    Time: 10.272
    Time: 10.354
    Time: 10.248
    Time: 10.253
    
    (average: 10.3012)
    
     a 13.8% savings!
    Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
    897f68a4
trace_functions.c 7.72 KB