• Steven Rostedt's avatar
    ring-buffer: change test to be more latency friendly · 3e07a4f6
    Steven Rostedt authored
    The ring buffer benchmark/test runs a producer for 10 seconds.
    This is done with preemption and interrupts enabled. But if the kernel
    is not compiled with CONFIG_PREEMPT, it basically stops everything
    but interrupts for 10 seconds.
    
    Although this is just a test and is not for production, this attribute
    can be quite annoying. It can also spawn badness elsewhere.
    
    This patch solves the issues by calling "cond_resched" when the system
    is not compiled with CONFIG_PREEMPT. It also keeps track of the time
    spent to call cond_resched such that it does not go against the
    time calculations. That is, if the task schedules away, the time scheduled
    out is removed from the test data. Note, this only works for non PREEMPT
    because we do not know when the task is scheduled out if we have PREEMPT
    enabled.
    
    [ Impact: prevent test from stopping the world for 10 seconds ]
    Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
    3e07a4f6
ring_buffer_benchmark.c 8.21 KB