advances in cpu idle time management · cpu idle time management original design and problem...

18
Advances in CPU Idle Time Management Rafael J. Wysocki Intel Open Source Technology Center August 30, 2018 Rafael J. Wysocki CPU Idle @ OSS 2018 August 30, 2018 1 / 18

Upload: others

Post on 08-Aug-2020

15 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Advances in CPU Idle Time Management · CPU Idle Time Management Original Design and Problem Original Idle Loop Design Issue CPU scheduler Try to stop tick need_resched()? YES NO

Advances in CPU Idle Time Management

Rafael J. Wysocki

Intel Open Source Technology Center

August 30, 2018

Rafael J. Wysocki CPU Idle @ OSS 2018 August 30, 2018 1 / 18

Page 2: Advances in CPU Idle Time Management · CPU Idle Time Management Original Design and Problem Original Idle Loop Design Issue CPU scheduler Try to stop tick need_resched()? YES NO

Introduction CPU Idle Time Concept

CPUs: Busy Vs Idle

Rafael J. Wysocki CPU Idle @ OSS 2018 August 30, 2018 2 / 18

Page 3: Advances in CPU Idle Time Management · CPU Idle Time Management Original Design and Problem Original Idle Loop Design Issue CPU scheduler Try to stop tick need_resched()? YES NO

Introduction CPU Idle States

CPU Idle States Properties

Time [a. u.]

Power [a. u.]

Entry ExitMR

Residency

Rafael J. Wysocki CPU Idle @ OSS 2018 August 30, 2018 3 / 18

Page 4: Advances in CPU Idle Time Management · CPU Idle Time Management Original Design and Problem Original Idle Loop Design Issue CPU scheduler Try to stop tick need_resched()? YES NO

Introduction CPU Idle States

CPU Idle States Example: C-states on Intel Hardware

MWAIT <HINT>

CPU 0

CPU 1

CPU 2

CPU 3

CPU 4

CPU 5

CPU 6

CPU 7

C6C2

C3 C3

C6C6

C6 C6

CC2 CC3

CC6 CC6PC2

Rafael J. Wysocki CPU Idle @ OSS 2018 August 30, 2018 4 / 18

Page 5: Advances in CPU Idle Time Management · CPU Idle Time Management Original Design and Problem Original Idle Loop Design Issue CPU scheduler Try to stop tick need_resched()? YES NO

CPU Idle Time Management Original Design and Problem

High-level CPU Idle Time Management Control Flow

CPU scheduler

Select state

Estimate idle time

CPU is idle

Enter state

Governor

YES

NO

menuladder

ACPI idleintel_idle

Rafael J. Wysocki CPU Idle @ OSS 2018 August 30, 2018 5 / 18

Page 6: Advances in CPU Idle Time Management · CPU Idle Time Management Original Design and Problem Original Idle Loop Design Issue CPU scheduler Try to stop tick need_resched()? YES NO

CPU Idle Time Management Original Design and Problem

Complication: CPU Scheduler Tick Timer

Rafael J. Wysocki CPU Idle @ OSS 2018 August 30, 2018 6 / 18

Page 7: Advances in CPU Idle Time Management · CPU Idle Time Management Original Design and Problem Original Idle Loop Design Issue CPU scheduler Try to stop tick need_resched()? YES NO

CPU Idle Time Management Original Design and Problem

Original Idle Loop Design Issue

CPU scheduler

Try to stop tick

need_resched()?YES

NO

Select state

Estimate idle time

Governor

Restart tick

Enter state

Interrupt

May be too short!

Rafael J. Wysocki CPU Idle @ OSS 2018 August 30, 2018 7 / 18

Page 8: Advances in CPU Idle Time Management · CPU Idle Time Management Original Design and Problem Original Idle Loop Design Issue CPU scheduler Try to stop tick need_resched()? YES NO

CPU Idle Time Management Original Design and Problem

Short Idle Duration Prediction Problem

WIN LOSS

LOSS LOSS

Short Idle

Short Idle

Long Idle

Long Idle

Predicted

Actual

Rafael J. Wysocki CPU Idle @ OSS 2018 August 30, 2018 8 / 18

Page 9: Advances in CPU Idle Time Management · CPU Idle Time Management Original Design and Problem Original Idle Loop Design Issue CPU scheduler Try to stop tick need_resched()? YES NO

CPU Idle Time Management Original Design and Problem

Issues With The menu Idle Governor

Rafael J. Wysocki CPU Idle @ OSS 2018 August 30, 2018 9 / 18

Page 10: Advances in CPU Idle Time Management · CPU Idle Time Management Original Design and Problem Original Idle Loop Design Issue CPU scheduler Try to stop tick need_resched()? YES NO

CPU Idle Time Management Idle Loop Rework

Redesigned Idle Loop (Linux* 4.17 And Later)

CPU scheduler

Try to stop tick

need_resched()?

NO

Select state

Estimate idle time

Governor

Restart tick

Enter state

Interrupt

Stop tick ortick stopped?

YES

NO

Tick stopped?NO

YES

* Other names and brands may be claimed as the property of others

Rafael J. Wysocki CPU Idle @ OSS 2018 August 30, 2018 10 / 18

Page 11: Advances in CPU Idle Time Management · CPU Idle Time Management Original Design and Problem Original Idle Loop Design Issue CPU scheduler Try to stop tick need_resched()? YES NO

CPU Idle Time Management Idle Loop Rework

Short Idle Duration Prediction Problem Mitigated

WIN LOSS

Neutral WIN

Short Idle

Short Idle

Long Idle

Long Idle

Predicted

Actual

Rafael J. Wysocki CPU Idle @ OSS 2018 August 30, 2018 11 / 18

Page 12: Advances in CPU Idle Time Management · CPU Idle Time Management Original Design and Problem Original Idle Loop Design Issue CPU scheduler Try to stop tick need_resched()? YES NO

CPU Idle Time Management Idle Loop Rework

Idle Power (Intel OTC Server Power Lab)

Rafael J. Wysocki CPU Idle @ OSS 2018 August 30, 2018 12 / 18

Page 13: Advances in CPU Idle Time Management · CPU Idle Time Management Original Design and Problem Original Idle Loop Design Issue CPU scheduler Try to stop tick need_resched()? YES NO

CPU Idle Time Management Idle Loop Rework

Idle Power (Intel OTC Server Power Lab) Continued

Rafael J. Wysocki CPU Idle @ OSS 2018 August 30, 2018 13 / 18

Page 14: Advances in CPU Idle Time Management · CPU Idle Time Management Original Design and Problem Original Idle Loop Design Issue CPU scheduler Try to stop tick need_resched()? YES NO

CPU Idle Time Management Idle Loop Rework

Idle Power (Intel OTC Server Power Lab) Continued

Rafael J. Wysocki CPU Idle @ OSS 2018 August 30, 2018 14 / 18

Page 15: Advances in CPU Idle Time Management · CPU Idle Time Management Original Design and Problem Original Idle Loop Design Issue CPU scheduler Try to stop tick need_resched()? YES NO

Features Under Development

CPU Idle Time Management And Power Domains

CPU 0

CPU 1

CPU 2

CPU 3

CPU 4

CPU 5

CPU 6

CPU 7

I/O I/O

I/O I/O

I/O I/O

I/OI/O

I/O

I/O

I/O

I/O

I/O

Rafael J. Wysocki CPU Idle @ OSS 2018 August 30, 2018 15 / 18

Page 16: Advances in CPU Idle Time Management · CPU Idle Time Management Original Design and Problem Original Idle Loop Design Issue CPU scheduler Try to stop tick need_resched()? YES NO

Questions?

Rafael J. Wysocki CPU Idle @ OSS 2018 August 30, 2018 16 / 18

Page 17: Advances in CPU Idle Time Management · CPU Idle Time Management Original Design and Problem Original Idle Loop Design Issue CPU scheduler Try to stop tick need_resched()? YES NO

Resources

References

Linux Kernel Bug 199227, Idle loop ordering issue (https://bugzilla.kernel.org/show_bug.cgi?id=199227).

T. Ilsche, M. Hahnel, R. Schohne, M. Bielert, D. Hackenberg,

Powernightmares: The Challenge of Efficiently Using Sleep States on Multi-Core Systems(https://tu-dresden.de/zih/forschung/ressourcen/dateien/projekte/haec/powernightmares.pdf?lang=en).

R. J. Wysocki, Power Management Challenges in Linux (https:

//www.linuxplumbersconf.org/2017/ocw//system/presentations/4652/original/linux_pm_challenges.pdf).

R. J. Wysocki, PM Infrastructure in the Linux Kernel – Current Status and Future

(https://events.linuxfoundation.org/sites/events/files/slides/kernel_PM_infra_0.pdf).

J. Corbet, The cpuidle subsystem (http://lwn.net/Articles/384146/).

Rafael J. Wysocki CPU Idle @ OSS 2018 August 30, 2018 17 / 18

Page 18: Advances in CPU Idle Time Management · CPU Idle Time Management Original Design and Problem Original Idle Loop Design Issue CPU scheduler Try to stop tick need_resched()? YES NO

Disclaimer

Intel technologies’ features and benefits depend on system configurationand may require enabled hardware, software or service activation.Performance varies depending on system configuration. No computersystem can be absolutely secure. Check with your system manufacturer orretailer or learn more at www.intel.com.

Intel and the Intel logo are trademarks of Intel Corporation in the U.S.and/or other countries. *Other names and brands may be claimed as theproperty of others.

c© Intel Corporation

Rafael J. Wysocki CPU Idle @ OSS 2018 August 30, 2018 18 / 18