cpuidle-haltpoll: set haltpoll as preferred governor
authorJoao Martins <joao.m.martins@oracle.com>
Sat, 7 Sep 2019 23:45:22 +0000 (00:45 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 11 Sep 2019 15:36:30 +0000 (17:36 +0200)
Right now, guest current governors have the following ratings:

 * ladder            -> 10
 * teo               -> 19
 * menu              -> 20
 * haltpoll          -> 21
 * ladder + nohz=off -> 25

haltpoll governor got introduced and it is now the default governor given
its highest rating -- with ladder+nohz being the exception -- regardless of
idle driver in the guest. An example of an undesirable case is x86 KVM
guests with MWAIT which have intel_idle registered first, and consequently
will have haltpoll be used as governor which would get limited to a poll
state and state 1 and the other states wouldn't get used.

To keep the previous defaults we decrease rating of governor to 9 (below
current lowest rating) and thus rely on @governor switch on
cpuidle_register_driver() to tie in haltpoll idle driver and governor
together.

Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpuidle/cpuidle-haltpoll.c
drivers/cpuidle/governors/haltpoll.c

index 56d8ab814466f11f7834eb03fa1b922427d18da1..519e90d125cfc6803ea74dedd11e7f869c16ca9f 100644 (file)
@@ -34,6 +34,7 @@ static int default_enter_idle(struct cpuidle_device *dev,
 
 static struct cpuidle_driver haltpoll_driver = {
        .name = "haltpoll",
+       .governor = "haltpoll",
        .owner = THIS_MODULE,
        .states = {
                { /* entry 0 is for polling */ },
index 797477bda4866f4cdbca63b57573eb5cfed68a20..7a703d2e006403cc73cd443a326c5adcb3bf58c9 100644 (file)
@@ -133,7 +133,7 @@ static int haltpoll_enable_device(struct cpuidle_driver *drv,
 
 static struct cpuidle_governor haltpoll_governor = {
        .name =                 "haltpoll",
-       .rating =               21,
+       .rating =               9,
        .enable =               haltpoll_enable_device,
        .select =               haltpoll_select,
        .reflect =              haltpoll_reflect,