Skip to content

sched/idle: Prevent pointless NOHZ transitions in default_idle_call()

Thomas Gleixner linux-pm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 20 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2sched/idle: Make default_idle_call() staticinclude/linux/cpuidle.h kernel/sched/idle.c+1 -20 replies
2/2sched/idle: Make default_idle_call() NOHZ awarekernel/sched/idle.c+57 -826 replies

Reviews trailers per patch

1 of 2 patches has a Reviewed-by or Acked-by.

PatchChristian LoehleAboorva DevarajanFrederic Weisbecker
1/2
2/2R-b R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v1 thread

Cover letter [patch 0/2] sched/idle: Prevent pointless NOHZ transitions in default_idle_call()

default_idle_call() is used when cpuidle is not available. That's the case on most virtual machines.

It unconditionally tries to transition to NOHZ idle mode on every invocation, which allows the hypervisor to go into long idle sleeps.

But that's counterproductive on a loaded system where CPUs go briefly idle for a couple of microseconds. That causes to reprogram the clock event device twice, one on entry and then when leaving idle a few microseconds later. That's especially hurtful for VMs as programming the clock event device implies a VM exit.

See also the related discussion here:

https://lore.kernel.org/875x7mv8wd.ffs@tglx

Cure this by implementing a moving average tracking idle time in default_idle_call() and only stop the tick when the resulting average idle time is larger than a tick.

The series applies on v7.0-rc1.

Thanks,

tglx

---
 include/linux/cpuidle.h |    1 
 kernel/sched/idle.c     |   65 ++++++++++++++++++++++++++++++++++++++++++------
 2 files changed, 57 insertions(+), 9 deletions(-)