Skip to content

Commit 716ff71

Browse files
lrq-maxrafaeljw
authored andcommitted
cpuidle-haltpoll: Replace default_idle() with arch_cpu_idle()
When a KVM guest has MWAIT, mwait_idle() is used as the default idle function. However, the cpuidle-haltpoll driver calls default_idle() from default_enter_idle() directly and that one uses HLT instead of MWAIT, which may affect performance adversely, because MWAIT is preferred to HLT as explained by the changelog of commit aebef63 ("x86: Remove vendor checks from prefer_mwait_c1_over_halt"). Make default_enter_idle() call arch_cpu_idle(), which can use MWAIT, instead of default_idle() to address this issue. Suggested-by: Thomas Gleixner <[email protected]> Suggested-by: Rafael J. Wysocki <[email protected]> Signed-off-by: Li RongQing <[email protected]> [ rjw: Changelog rewrite ] Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 4edc13a commit 716ff71

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

arch/x86/kernel/process.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -721,6 +721,7 @@ void arch_cpu_idle(void)
721721
{
722722
x86_idle();
723723
}
724+
EXPORT_SYMBOL_GPL(arch_cpu_idle);
724725

725726
/*
726727
* We use this if we don't have any better idle routine..

drivers/cpuidle/cpuidle-haltpoll.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ static int default_enter_idle(struct cpuidle_device *dev,
3232
local_irq_enable();
3333
return index;
3434
}
35-
default_idle();
35+
arch_cpu_idle();
3636
return index;
3737
}
3838

0 commit comments

Comments
 (0)