sched: scheduler-driven cpu frequency selection
authorMichael Turquette <mturquette@baylibre.com>
Tue, 30 Jun 2015 11:45:48 +0000 (12:45 +0100)
committerPunit Agrawal <punit.agrawal@arm.com>
Mon, 21 Mar 2016 12:42:03 +0000 (12:42 +0000)
commit4b01d9785bb0adb3ddea2624c8411cca0865b772
treeb078e9e6e1285cfd760d3a3f90b32bd83234daa2
parent41cd340c358f44bf50471dcb8ab1d79a276d3da5
sched: scheduler-driven cpu frequency selection

Scheduler-driven CPU frequency selection hopes to exploit both
per-task and global information in the scheduler to improve frequency
selection policy, achieving lower power consumption, improved
responsiveness/performance, and less reliance on heuristics and
tunables. For further discussion on the motivation of this integration
see [0].

This patch implements a shim layer between the Linux scheduler and the
cpufreq subsystem. The interface accepts capacity requests from the
CFS, RT and deadline sched classes. The requests from each sched class
are summed on each CPU with a margin applied to the CFS and RT
capacity requests to provide some headroom. Deadline requests are
expected to be precise enough given their nature to not require
headroom. The maximum total capacity request for a CPU in a frequency
domain drives the requested frequency for that domain.

Policy is determined by both the sched classes and this shim layer.

Note that this algorithm is event-driven. There is no polling loop to
check cpu idle time nor any other method which is unsynchronized with
the scheduler, aside from a throttling mechanism to ensure frequency
changes are not attempted faster than the hardware can accommodate them.

Thanks to Juri Lelli <juri.lelli@arm.com> for contributing design ideas,
code and test results, and to Ricky Liang <jcliang@chromium.org>
for initialization and static key inc/dec fixes.

[0] http://article.gmane.org/gmane.linux.kernel/1499836

[smuckle@linaro.org: various additions and fixes, revised commit text]

CC: Ricky Liang <jcliang@chromium.org>
Signed-off-by: Michael Turquette <mturquette@baylibre.com>
Signed-off-by: Juri Lelli <juri.lelli@arm.com>
Signed-off-by: Steve Muckle <smuckle@linaro.org>
drivers/cpufreq/Kconfig
include/linux/cpufreq.h
include/linux/sched.h
kernel/sched/Makefile
kernel/sched/cpufreq_sched.c [new file with mode: 0644]
kernel/sched/fair.c
kernel/sched/sched.h