OSDN Git Service

cpuidle: allow governor switch on cpuidle_register_driver()
authorJoao Martins <joao.m.martins@oracle.com>
Sat, 7 Sep 2019 23:45:21 +0000 (00:45 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 11 Sep 2019 15:36:30 +0000 (17:36 +0200)
commitcb5d8c45ab6c3daf8269e550cfb2d5018a876fe3
tree0d045a3cc65bd198bf7f139a550005a96b1ef4a5
parentcd4c0763064f02f42824eed61be38eafdc702281
cpuidle: allow governor switch on cpuidle_register_driver()

The recently introduced haltpoll driver is largely only useful with
haltpoll governor. To allow drivers to associate with a particular idle
behaviour, add a @governor property to 'struct cpuidle_driver' and thus
allow a cpuidle driver to switch to a *preferred* governor on idle driver
registration. We save the previous governor, and when an idle driver is
unregistered we switch back to that.

The @governor can be overridden by cpuidle.governor= boot param or
alternatively be ignored if the governor doesn't exist.

Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpuidle/cpuidle.h
drivers/cpuidle/driver.c
drivers/cpuidle/governor.c
include/linux/cpuidle.h