[RFC PATCH v1 00/11] Create fast idle path for short idle periods

From: Aubrey Li
Date: Sun Jul 09 2017 - 21:48:56 EST

From: Aubrey Li <aubrey.li@xxxxxxxxxxxxxxx>

Under some latency intensive workloads, short idle periods occurs very
common, so that idle entry and exit path starts to dominate. It's important
to optimize them for the short idle period pattern. A fast idle path proposal
is introduced here for this purpose.

This proposal uses two factors in idle menu governor to predict the next
idle period. The one is energy break even point, the other is repeatable
interval detector. These two factors are generic to all arches.

If the next idle period is longer than the predefined threshold, that means
the next idle will be a long idle, then the idle thread will enter the
original normal idle path. Otherwise, the coming idle will be a short idle,
the idle thread will enter the fast idle path, which is supposed to enter
and exit faster than the normal path.

The predicted idle period is already computed in the cpuidle framework, so
pass it directly to menu governor to select the next c-state. Menu governor
does not need to compute again.

We measured 3%~5% improvemnt in disk IO workload, and 8%~20% improvement in
network workload.

Aubrey Li (11):
sched/idle: create a fast path for short idle periods
cpuidle: attach cpuidle governor statistics to the per-CPU device
cpuidle: introduce cpuidle governor for idle prediction
sched/idle: make the fast idle path for short idle periods
cpuidle: update idle statistics before cpuidle governor
timers: keep sleep length updated as needed
cpuidle: make idle residency update more generic
cpuidle: menu: remove reduplicative implementation
cpuidle: menu: feed cpuidle prediction to menu governor
cpuidle: update cpuidle governor when needed
sched/idle: Add a tuning knob to allow changing fast idle threshold

drivers/cpuidle/cpuidle.c | 241 +++++++++++++++++++++++++++++++++++++++
drivers/cpuidle/governors/menu.c | 192 +------------------------------
include/linux/cpuidle.h | 35 ++++++
include/linux/sched/sysctl.h | 1 +
kernel/sched/idle.c | 81 +++++++++++--
kernel/sysctl.c | 10 ++
kernel/time/tick-sched.c | 3 +
7 files changed, 366 insertions(+), 197 deletions(-)