• Daniel Lezcano's avatar
    genirq/timings: Add array suffix computation code · bbba0e7c
    Daniel Lezcano authored
    The previous approach based on the variance was discarding values from
    the timings when they were considered as anomalies as stated by the
    normal law statistical model.
    
    However in the interrupt life, there can be multiple anomalies due to the
    nature of the device generating the interrupts, and most of the time a
    repeating pattern can be observed, that is particulary true for network,
    console, MMC or SSD devices.
    
    The variance approach missed the patterns and it was only able to deal with
    the interrupt coming in regular intervals, thus reducing considerably the
    scope of what is predictable.
    
    In order to find out the repeating patterns, the interrupt intervals are
    grouped in a ilog2 basis to create a suite of numbers with small
    amplitude. Every group contains an exponential moving average of the values
    belonging to the group. The array suffix, a data structure used for string
    searching, data compression, etc ..., is built from the suite of numbers
    and the suffixes are then searched in this suite.
    
    The tests showed the algorithm is able to find all repeating patterns,
    as well as regular interval in less than 1us on x86-i7.
    Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
    Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
    Cc: rjw@rjwysocki.net
    Cc: ulf.hansson@linaro.org
    Cc: linux-pm@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190328151336.5316-2-daniel.lezcano@linaro.org
    bbba0e7c
timings.c 16 KB