EAS in Android Common...

125
© 2017 Arm Limited EAS in Android Common Kernel Linaro Connect Hong Kong 2018 Chris Redpath Quentin Perret Open Source Software

Transcript of EAS in Android Common...

Page 1: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited

EAS in Android Common Kernel

Linaro ConnectHong Kong 2018

Chris Redpath

Quentin Perret

Open Source Software

Page 2: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 2

EAS in Android Common Kernel

AOSP Common Kernel Update

EAS Mainline Strategy

EAS Upstreaming

Page 3: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited

AOSP Common Kernel Update

Page 4: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 4

AOSP Common Kernel Update

• EAS r1.3, July 2017

• android-4.4, android-4.9

• Default cpufreq governor switched to schedutil, sched-freq removed

• Backports of upstream schedutil changes

• Upstream backports of relevant scheduler features

android-4.4

android-4.9

android-4.14

EAS r1.3 EAS r1.4 EAS r1.5

Page 5: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 5

AOSP Common Kernel Update

• EAS r1.4, November 2017

• android-4.4, android-4.9

• Upstream backports of more scheduler and schedutil patches

• Energy diff improvements & fixes

• android-4.14 EAS released including 1.4 & most 1.5 functionality

android-4.4

android-4.9

android-4.14

EAS r1.3 EAS r1.4 EAS r1.5

Page 6: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 6

EAS in android-4.14

A new set of patches implementing EAS rather than forward-porting

• Based upon our latest mainline-focussed integration branch

• Refactored latest android-eas on top to build clean set of patches

• More Experimental features placed behind sched_features

• Feature configuration matches android-4.9

• Produced during linux-4.14 rc phase, ready 2-weeks after linux-4.14

Page 7: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 7

EAS in android-4.14android-specific

Upstream-targeted

find_best_target

schedtune

WALT Trace & Debug

Topology DetectionInvariance Support

Use of idle states

Rt-PELT

Schedutil changes

Sync Wakeups

Energy Diff Calculation

NOHZ Signal Updates

Misfit Tasks&

Overutilized Flags

Load balance tweaks

Page 8: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 8

AOSP Common Kernel Update

• EAS r1.5, Feb 2018 (eas-dev), merging to android-4.9 soon

• android-4.9 only, most changes already in android-4.14

• Refactored energy diff to make calculation more efficient

• Further refinement of EAS CPU pre-selection (find_best_target)

– Thanks for excellent contributions from Qualcomm, Spreadtrum, Mstar, Linaro

• Aggressive up-migrate of Misfit tasks & WALT updates from CodeAurora

android-4.4

android-4.9

android-4.14

EAS r1.3 EAS r1.4 EAS r1.5

Page 9: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 9

AOSP Common Kernel Update

• EAS r1.6, eas-dev starting April 2018

• Moving to android-4.14

• Adding back Schedtune PE space filtering

• Util_est backport, with PELT decay rate changes

• Use mainline wakeup code for prefer_idle tasks

• Remove ordering dependency in find_best_target

– ( better tri-gear support when using find_best_target )

android-4.4

android-4.9

android-4.14

EAS r1.5 EAS r1.6

Page 10: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 10

AOSP Common Kernel Update

Branches:

• android-4.4, android-4.9 & android-4.14

• Common kernel upstream for device kernels

• Only post against this for bugfixes

• People merge these into device kernels, so need to be selective about changes

Page 11: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 11

AOSP Common Kernel Update

More branches:

• android-4.9-eas-dev (soon android-4.14-eas-dev)

• This is where in-development patches should be posted

• Arm power team usually post patches at RFC stage to stimulate discussion

• Changes picked or merged back to common

• android-4.4-eas-test (android-4.9-eas-test later)

• Test branch is against android common for the latest well-supported public device

• Intended to hold backports of EAS patches which merged into the active common branch, but did not get back to the branch we test with

Page 12: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 12

AOSP Common Kernel Update

There have been some consistent themes in EAS development over the last year or so:

Page 13: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 13

AOSP Common Kernel Update

There have been some consistent themes in EAS development over the last year or so:

• Reducing delta with mainline

Page 14: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 14

AOSP Common Kernel Update

There have been some consistent themes in EAS development over the last year or so:

• Reducing delta with mainline

• Refactoring to improve maintainability and predictability

Page 15: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 15

AOSP Common Kernel Update

There have been some consistent themes in EAS development over the last year or so:

• Reducing delta with mainline

• Refactoring to improve maintainability and predictability

• New features where necessary

Page 16: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 16

AOSP Common Kernel Update

There have been some consistent themes in EAS development over the last year or so:

• Reducing delta with mainline

• Refactoring to improve maintainability and predictability

• New features where necessary

• Open, collaborative development

Page 17: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 17

AOSP Common Kernel Update

Open Development

• Patches for AOSP are reviewed on AOSP Gerrit

• https://android-review.googlesource.com

• We always try to justify patches with performance & energy numbers – use wltests for this

• Wltests is part of LISA https://www.github.com/arm-software/lisa

• Discussion of other topics and announcements are on Linaro’s eas-dev list

• https://lists.linaro.org/mailman/listinfo/eas-dev

Page 18: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited

EAS Mainline Strategy

Page 19: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 19

EAS Mainline Strategy

• EAS is a large, complex piece of functionality

• EAS being in AOSP helps a lot of users but not all

• Upstream development results in better code

Page 20: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 20

EAS Mainline Strategy

• We make regular bi-weekly integrations of all our upstream-focussed code

• Available on linux-arm.org & announced on eas-dev

• Allows us to more easily see when changes impact us and work to resolve as soon as possible

• Have been identifying suitable code we already have

• Working on getting them into acceptable shape

• Pushing when we think they are good enough for a review

• Hoping to upstream quite a lot of EAS this year

Page 21: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 21

EAS Mainline Strategy

• Also working upstream where we can and backporting to Android

• schedutil fixes

• cpu signal updates

• any fix/change applicable and potentially useful elsewhere

• participating in reviews and testing

Page 22: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 22

EAS in AOSP

EAS Code Size by Category Target EAS Code Size by Category

Android-specific 3797 824

WALT 1470 0

Upstreamable Features 2785 2785

Documentation 1153 1153

1153 1153

2785 2785

1470

0

3797

824

Page 23: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 23

EAS Size

100.00%

14.76%

0.00%

20.00%

40.00%

60.00%

80.00%

100.00%

120.00%

EAS Code size in android-4.14 Android Specific Code Target (rough estimate if everything goes to plan, mid-2019)

ANDROID-SPECIFIC EAS CODE SIZE

Page 24: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 24

Bringing EAS in AOSP Closer to Mainline

1. Reach performance/energy parity with WALT

• WALT is great for mobile but not popular upstream

• It’s also 1.5k LoC

• Touches many parts of the scheduler we want to change upstream, which makes backporting harder

Page 25: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 25

Bringing EAS in AOSP Closer to Mainline

1. Reach performance/energy parity with WALT

• Disable WALT by default in android-common when ready

2. Push better support for big.LITTLE into mainline scheduler

• Push out-of-tree wakeup and periodic balance changes upstream

• Push energy diff calculations upstream

Page 26: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 26

Bringing EAS in AOSP Closer to Mainline

1. Reach performance/energy parity with WALT

• Disable WALT by default in android-common when ready

2. Push better support for big.LITTLE into mainline scheduler

• Push out-of-tree wakeup and periodic balance changes upstream

• Push energy diff calculations upstream

3. Expect to continue to carry mobile-specific changes in AOSP

• Schedutil up/down throttle split

• Rt-rq signals

• Performance/Energy task classification

Page 27: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited

EAS Upstreaming

Page 28: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 28

EAS Upstreaming

7 areas identified for upstreaming.

Feature Status

Energy Model On LKML (v1 March 2018, during Connect!)

Frequency and Cpu Invariant Engines (FIE/CIE) Merged in v4.15

Idle Cpu PELT update (Remote status update) Merged in tip/sched/core

Util Est Merged in tip/sched/core (during Connect!)

Util Clamp Almost ready (v1 on LKML April 2018)

Misfit Task On LKML (v2 March 2018)

Dynamic Topology Flag Detection In development, many scenarios to cover

Page 29: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 29

EAS Upstreaming

• Util-Est

• Add an aggregator on top of the PELT estimator

– keep track of what “we learned” about task’s previous activations

– generate a “new” signal on top of PELT

• Build a low-overhead statistic for SEs and CPUs

– Tasks at dequeue time

– Root RQs at task enqueue/dequeue

• Lots of detail at last year’s OSPM Summit and lkml

• Patches merged into upstream tip/sched/core branch

Page 30: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 30

EAS Upstreaming

• Misfit Tasks

• Promote long-running tasks to most capable Cpus

• Key to achieving consistent performance in heterogenous systems

• Tasks which don’t sleep need active migration

Page 31: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited

A Simplified Energy Model for EAS

Page 32: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 32

An Energy Model: why ?

• Power/perf. characteristics differ between different SoCs

• Heuristics don’t perform well on many platforms

• The Energy Model enables the design of a platform-agnostic algorithm in the scheduler

• Designed for mainline

Page 33: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 33

Summary

1. Today’s Energy Model

2. Which simplified Energy Model ?

3. Mainline implementation

4. Conclusion

Page 34: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 34

Summary

1. Today’s Energy Model

2. Which simplified Energy Model ?

3. Mainline implementation

4. Conclusion

Page 35: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 35

The Energy Model in Android / Hikey960

Page 36: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 36

The Energy Model in Android / Hikey960

LITTLE big

MHz Cap. Cost MHz Cap. Cost

533 133 87 903 390 404

999 250 167 1421 615 861

1402 351 265 1805 782 1398

1709 429 388 2112 915 2200

1844 462 502 2362 1024 2848

0

500

1000

1500

2000

2500

3000

0 200 400 600 800 1000

CP

U L

EVEL

Capacity

Pow

er

Page 37: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 37

The Energy Model in Android / Hikey960

LITTLE big

MHz Cap. Cost MHz Cap. Cost

533 133 87 903 390 404

999 250 167 1421 615 861

1402 351 265 1805 782 1398

1709 429 388 2112 915 2200

1844 462 502 2362 1024 2848

0

500

1000

1500

2000

2500

3000

0 200 400 600 800 1000

CP

U L

EVEL LITTLE big

5 18

5 18

0 0

0 0

Capacity

Pow

er

Page 38: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 38

The Energy Model in Android / Hikey960

LITTLE big

MHz Cap. Cost MHz Cap. Cost

533 133 87 903 390 404

999 250 167 1421 615 861

1402 351 265 1805 782 1398

1709 429 388 2112 915 2200

1844 462 502 2362 1024 2848

0

100

200

300

400

500

0 200 400 600 800 1000

LITTLE big

MHz Cap. Cost MHz Cap. Cost

533 133 12 903 390 102

999 250 22 1421 615 124

1402 351 36 1805 782 221

1709 429 67 2112 915 330

1844 462 144 2362 1024 433

0

500

1000

1500

2000

2500

3000

0 200 400 600 800 1000

CP

U L

EVEL

CLU

STER

LEV

EL

LITTLE big

5 18

5 18

0 0

0 0

LITTLE big

12 102

12 102

12 102

0 0

Capacity

Capacity

Pow

erPo

wer

Page 39: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 39

Device-tree bindings

Page 40: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 40

Device-tree bindings[...]cpu0: cpu@0 {

[...]sched-energy-costs = <&CPU_COST_A53 &CL_COST_A53>;[...]

}

[...]

cpu1: cpu@1 {[...]sched-energy-costs = <&CPU_COST_A53 &CL_COST_A53>;[...]

}

[...]

cpu4: cpu@100 {[...]sched-energy-costs = <&CPU_COST_A72 &CL_COST_A72>;[...]

}

arch/arm64/boot/dts/hisilicon/hi3660.dtsi

Page 41: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 41

Device-tree bindings[...]cpu0: cpu@0 {

[...]sched-energy-costs = <&CPU_COST_A53 &CL_COST_A53>;[...]

}

[...]

cpu1: cpu@1 {[...]sched-energy-costs = <&CPU_COST_A53 &CL_COST_A53>;[...]

}

[...]

cpu4: cpu@100 {[...]sched-energy-costs = <&CPU_COST_A72 &CL_COST_A72>;[...]

}

CPU_COST_A72: core-cost0 {busy-cost-data = <

390 404615 861782 1398915 22001024 2848 >;

idle-cost-data = < 18 18 0 0 >;};CPU_COST_A53: core-cost1 {

busy-cost-data = <133 87250 164351 265429 388462 502 >;

idle-cost-data = < 5 5 0 0 >;};CLUSTER_COST_A72: cluster-cost0 {

busy-cost-data = <

[...]

arch/arm64/boot/dts/hisilicon/hi3660.dtsi arch/arm64/boot/dts/hisilicon/hi3660-sched-energy.dtsi

Page 42: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 42

Device-tree bindings[...]cpu0: cpu@0 {

[...]sched-energy-costs = <&CPU_COST_A53 &CL_COST_A53>;[...]

}

[...]

cpu1: cpu@1 {[...]sched-energy-costs = <&CPU_COST_A53 &CL_COST_A53>;[...]

}

[...]

cpu4: cpu@100 {[...]sched-energy-costs = <&CPU_COST_A72 &CL_COST_A72>;[...]

}

CPU_COST_A72: core-cost0 {busy-cost-data = <

390 404615 861782 1398915 22001024 2848 >;

idle-cost-data = < 18 18 0 0 >;};CPU_COST_A53: core-cost1 {

busy-cost-data = <133 87250 164351 265429 388462 502 >;

idle-cost-data = < 5 5 0 0 >;};CLUSTER_COST_A72: cluster-cost0 {

busy-cost-data = <

[...]

arch/arm64/boot/dts/hisilicon/hi3660.dtsi arch/arm64/boot/dts/hisilicon/hi3660-sched-energy.dtsi

Page 43: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 43

Sched domains

Page 44: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 44

Sched domains

CPU 0

Page 45: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 45

Sched domains

MC 0 1 2 3

0 1 2 3

groups

CPU span

CPU 0

Page 46: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 46

Sched domains

MC 0 1 2 3

0 1 2 3

groups

CPU span

CPU 0

LITTLE

Cap. Cost

133 87

250 167

351 265

429 388

462 502

LITTLE

5

5

0

0

CPU

Page 47: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 47

Sched domains

MC

DIE

0 1 2 3

10 11

0 1 2 3 4 5 6 7

parent

groups

groups

CPU span

CPU 0

LITTLE

Cap. Cost

133 87

250 167

351 265

429 388

462 502

LITTLE

5

5

0

0

CPU

Page 48: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 48

Sched domains

MC

DIE

0 1 2 3

10 11

0 1 2 3 4 5 6 7

parent

groups

groups

CPU span

CPU 0

LITTLE

Cap. Cost

133 87

250 167

351 265

429 388

462 502

LITTLE

5

5

0

0

CPU

big

Cap. Cost

390 102

615 124

782 221

915 330

1024 433

big

102

102

102

0

ClusterCluster

LITTLE

12

12

12

0

LITTLE

Cap. Cost

133 12

250 22

351 36

429 67

462 144

Page 49: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 49

Need for simplification

• Comprehensive Energy Model, but …

Page 50: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 50

Need for simplification

• Comprehensive Energy Model, but …

• Complex to measure for new platforms

Page 51: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 51

Need for simplification

• Comprehensive Energy Model, but …

• Complex to measure for new platforms

• Computationally expensive scheduling decisions

Page 52: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 52

Need for simplification

• Comprehensive Energy Model, but …

• Complex to measure for new platforms

• Computationally expensive scheduling decisions

• Existing code relies only on out-of-tree bindings

Page 53: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 53

Need for simplification

• Comprehensive Energy Model, but …

• Complex to measure for new platforms

• Computationally expensive scheduling decisions

• Existing code relies only on out-of-tree bindings

• Inaccurate assumptions for future platforms

Page 54: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 54

Summary

1. Today’s Energy Model

2. Which simplified Energy Model ?

3. Mainline implementation

4. Conclusion

Page 55: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 55

Which simplified EM ?

Page 56: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 56

Which simplified EM ?

NameCPU Level Cluster Level

Active costs Idle costs Active costs Idle costs

FULL YES YES YES YES

NOIDLE YES NO YES NO

NOCLUSTER YES YES NO NO

NOCLUSTER_NOIDLE YES NO NO NO

NO_EAS NO NO NO NO

Page 57: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 57

Which simplified EM ?

NameCPU Level Cluster Level

Active costs Idle costs Active costs Idle costs

FULL YES YES YES YES

NOIDLE YES NO YES NO

NOCLUSTER YES YES NO NO

NOCLUSTER_NOIDLE YES NO NO NO

NO_EAS NO NO NO NO

Page 58: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 58

Which simplified EM ?

NameCPU Level Cluster Level

Active costs Idle costs Active costs Idle costs

FULL YES YES YES YES

NOIDLE YES NO YES NO

NOCLUSTER YES YES NO NO

NOCLUSTER_NOIDLE YES NO NO NO

NO_EAS NO NO NO NO

Page 59: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 59

Which simplified EM ?

NameCPU Level Cluster Level

Active costs Idle costs Active costs Idle costs

FULL YES YES YES YES

NOIDLE YES NO YES NO

NOCLUSTER YES YES NO NO

NOCLUSTER_NOIDLE YES NO NO NO

NO_EAS NO NO NO NO

Page 60: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 60

Which simplified EM ?

NameCPU Level Cluster Level

Active costs Idle costs Active costs Idle costs

FULL YES YES YES YES

NOIDLE YES NO YES NO

NOCLUSTER YES YES NO NO

NOCLUSTER_NOIDLE YES NO NO NO

NO_EAS NO NO NO NO

Page 61: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 61

Which simplified EM ?

NameCPU Level Cluster Level

Active costs Idle costs Active costs Idle costs

FULL YES YES YES YES

NOIDLE YES NO YES NO

NOCLUSTER YES YES NO NO

NOCLUSTER_NOIDLE YES NO NO NO

NO_EAS NO NO NO NO

Page 62: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 62

Which simplified EM ?

NameCPU Level Cluster Level

Active costs Idle costs Active costs Idle costs

FULL YES YES YES YES

NOIDLE YES NO YES NO

NOCLUSTER YES YES NO NO

NOCLUSTER_NOIDLE YES NO NO NO

NO_EAS NO NO NO NO

• Tested on Android-4.4: Hikey960, Pixel2, Hikey620

Page 63: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 63

Which simplified EM ?

NameCPU Level Cluster Level

Active costs Idle costs Active costs Idle costs

FULL YES YES YES YES

NOIDLE YES NO YES NO

NOCLUSTER YES YES NO NO

NOCLUSTER_NOIDLE YES NO NO NO

NO_EAS NO NO NO NO

• Tested on Android-4.4: Hikey960, Pixel2, Hikey620

• SchedTune disabled, no cpusets

Page 64: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 64

Jankbench / list_view - Hikey960

FULL

NOIDLE

NOCLUSTER_NOIDLE

NOCLUSTER

NO_EAS

Page 65: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 65

Jankbench / list_view - Hikey960

FULL

NOIDLE

NOCLUSTER_NOIDLE

NOCLUSTER

NO_EAS

Mean

Page 66: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 66

Jankbench / list_view - Hikey960

FULL

NOIDLE

NOCLUSTER_NOIDLE

NOCLUSTER

NO_EAS

Page 67: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 67

Jankbench / list_view - Hikey960

FULL

NOIDLE

NOCLUSTER_NOIDLE

NOCLUSTER

NO_EAS

50%

Page 68: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 68

Jankbench / list_view - Hikey960

FULL

NOIDLE

NOCLUSTER_NOIDLE

NOCLUSTER

NO_EAS

50%

~99%

Page 69: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 69

Jankbench / list_view - Hikey960

FULL

NOIDLE

NOCLUSTER_NOIDLE

NOCLUSTER

NO_EAS

Page 70: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 70

Jankbench / image_list_view - Hikey960

FULL

NOIDLE

NOCLUSTER_NOIDLE

NOCLUSTER

NO_EAS

Page 71: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 71

Jankbench / low_hitrate_text - Hikey960

FULL

NOIDLE

NOCLUSTER_NOIDLE

NOCLUSTER

NO_EAS

Page 72: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 72

Jankbench / shadow_grid - Hikey960

FULL

NOIDLE

NOCLUSTER_NOIDLE

NOCLUSTER

NO_EAS

Page 73: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 73

Jankbench / edit_text - Hikey960

FULL

NOIDLE

NOCLUSTER_NOIDLE

NOCLUSTER

NO_EAS

Page 74: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 74

Homescreen / Hikey960

FULL

NOIDLE

NOCLUSTER_NOIDLE

NOCLUSTER

NO_EAS

Page 75: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 75

ExoPlayer Video / Hikey960

FULL

NOIDLE

NOCLUSTER_NOIDLE

NOCLUSTER

NO_EAS

Page 76: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 76

ExoPlayer Audio / Hikey960

FULL

NOIDLE

NOCLUSTER_NOIDLE

NOCLUSTER

NO_EAS

Page 77: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 77

Results of experiments

• Hikey960: all energy models show comparable energy savings

• Pixel2: same conclusions with smaller savings (up to 13%, screen on)

• Hikey620 (SMP): No significant savings

Page 78: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 78

Results of experiments

• Hikey960: all energy models show comparable energy savings

• Pixel2: same conclusions with smaller savings (up to 13%, screen on)

• Hikey620 (SMP): No significant savings

The simplest EM (noidle_nocluster) is

a reasonable option for modern platforms

Page 79: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 79

Summary

1. Today’s Energy Model

2. Which simplified Energy Model ?

3. Mainline implementation

4. Conclusion

Page 80: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 80

Dynamic power model

Page 81: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 81

Dynamic power model

𝑃 = 𝐶 ∗ 𝑉 2 ∗ 𝑓

2 2 𝑓

Page 82: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 82

Dynamic power model

𝑃 = 𝐶 ∗ 𝑉 2 ∗ 𝑓

2 2 𝑓

Power

Page 83: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 83

Dynamic power model

𝑃 = 𝐶 ∗ 𝑉 2 ∗ 𝑓

2 2 𝑓

Power Capacitance

Page 84: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 84

Dynamic power model

𝑃 = 𝐶 ∗ 𝑉 2 ∗ 𝑓

2 2 𝑓

Power Capacitance Voltage

Page 85: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 85

Dynamic power model

𝑃 = 𝐶 ∗ 𝑉 2 ∗ 𝑓

2 2 𝑓

Power Capacitance Voltage Frequency

Page 86: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 86

Dynamic power model

𝑃 = 𝐶 ∗ 𝑉 2 ∗ 𝑓

2 2 𝑓

Power Capacitance Voltage Frequency

Mainline DT binding:

dynamic-power-coefficient

Page 87: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 87

Dynamic power model

𝑃 = 𝐶 ∗ 𝑉 2 ∗ 𝑓

2 2 𝑓

Power Capacitance Voltage Frequency

Mainline DT binding:

dynamic-power-coefficientManaged by CPUFreq / OPP

Page 88: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 88

Energy Model Comparison / Hikey960

1

11

21

31

41

51

61

71

81

91

200 700 1200 1700 2200

Measured

𝐶 ∗ 𝑉2 ∗ 𝑓

Frequency (MHz).

Pow

er (

%)

Page 89: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 89

Architecture

Page 90: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 90

Architecture

Thermal / IPA

𝑃 = 𝐶𝑉2𝑓

PM OPP

Device Tree

𝑉 𝑓

𝐶

Page 91: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 91

Architecture

Thermal / IPA

PM OPP

Device Tree

𝑉 𝑓

𝐶

Page 92: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 92

Architecture

Thermal / IPA

PM OPP

Device Tree

𝑉 𝑓

𝐶

𝑃

𝐶𝑉2𝑓

Page 93: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 93

Architecture

Thermal / IPA

PM OPP

Device Tree

𝑉 𝑓

𝐶

𝑃

𝐶𝑉2𝑓

Scheduler

Energy Model

Page 94: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 94

Architecture

Thermal / IPA

PM OPP

Device Tree

𝑉 𝑓

𝐶

𝑃

𝐶𝑉2𝑓

Scheduler

Energy Model

SCMI

Page 95: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 95

Architecture

Thermal / IPA

PM OPP

Device Tree

𝑉 𝑓

𝐶

𝑃

𝐶𝑉2𝑓

Scheduler

Energy Model

SCMI Other ?

Page 96: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 96

Architecture

Thermal / IPA

PM OPP

Device Tree

𝑉 𝑓

𝐶

𝑃

𝐶𝑉2𝑓

Scheduler

Energy Model

SCMI Other ?

[PATCH v3 0/2] thermal, OPP: move the CPU power estimation to the OPP library-> [PATCH v3 1/2] PM / OPP: introduce an OPP power estimation helper-> [PATCH v3 2/2] thermal: cpu_cooling: use power models from the OPP library

Page 97: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 97

Implementation

• No hierarchical data, no need to use the scheduling domains

• Data structures:

• Loaded from PM / OPP at boot time, after CPUfreq is setup

• Energy models are stored in a flat per-cpu array

• Frequency domains are stored in cpu-masks

Page 98: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 98

Assumptions

• All CPUs in a freq. domain share capacity states

• All CPUs in a freq. domain have the same micro-architecture

• Possible to relax this if needed, but higher computational cost

• EAS enabled for asymmetric platforms only (SD_ASYM_CPUCAPACITY flag set)

• EAS shines on heterogeneous platforms

• Avoid “conflicts” for purely perf-oriented platforms (servers, …)

Page 99: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 99

Tests against mainline

• Test setup:

• Platform: Hikey960 and Juno r0

• Debian userspace

• Base kernel: tip/sched/core – 4.16-rc2

• Test cases:

• Energy: “X” RTApp tasks, 16ms period, 5% duty cycle, 30 seconds

• Performance: `perf bench sched messaging –pipe –thread –group X –loop 50000`

Page 100: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 100

Tests against mainline / Energy

0

10

20

30

40

50

60

70

80

90

100

10 tasks 20 tasks 30 tasks 40 tasks 50 tasks

tip/sched/core EAS

0

10

20

30

40

50

60

70

80

90

100

10 tasks 20 tasks 30 tasks 40 tasks 50 tasks

tip/sched/core EAS

Hikey960 (ACME / full SoC + memory) Juno (HW monitor / b.L CPUs only)

Ener

gy (

%)

Ener

gy (

%)

Page 101: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 101

Tests against mainline / Perf.

0

10

20

30

40

50

60

70

40 tasks 80 tasks 160 tasks 320 tasks

tip/sched/core EAS

0

10

20

30

40

50

60

40 tasks 80 tasks 160 tasks 320 tasks

tip/sched/core EAS

Hikey960 Juno

Tim

e (s

)

Tim

e (s

)

Page 102: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 102

Posted to LKML this week

[RFC PATCH 0/6] Energy Aware Scheduling

[RFC PATCH 1/6] sched/fair: Create util_fits_capacity()

[RFC PATCH 2/6] sched: Introduce energy models of CPUs

[RFC PATCH 3/6] sched: Add over-utilization/tipping point indicator

[RFC PATCH 4/6] sched/fair: Introduce an energy estimation helper …

[RFC PATCH 5/6] sched/fair: Select an energy-efficient CPU on task …

[RFC PATCH 6/6] drivers: base: arch_topology.c: Enable EAS for arm/…

Page 103: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 103

Summary

1. Today’s Energy Model

2. Which simplified Energy Model ?

3. Mainline implementation

4. Conclusion

Page 104: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 104

Next steps

• Ideal scenario: simplified EM goes in the next LTS (4.19 ?)

• Test & assessment on android-4.14

• In case of gaps with the full EM, they will be filled in product

Page 105: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 105

Thanks.Any questions ?

Page 106: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

106106 © 2017 Arm Limited

The Arm trademarks featured in this presentation are registered trademarks or trademarks of Arm Limited (or its subsidiaries) in the US and/or elsewhere. All rights reserved. All other marks featured may be trademarks of their respective owners.

www.arm.com/company/policies/trademarks

Page 107: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 107

Algorithm complexity

T1cap=100

cost=100

cap=350cost=400

cap=500cost=800

CPU0 CPU1 CPU2 CPU3

cap=400cost=700

cap=600cost=1000

cap=800cost=1800

CPU4 CPU5 CPU6 CPU7

cap=1000cost=3000

LITTLE CPUs BIG CPUs

Page 108: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 108

Algorithm complexity

T1cap=100

cost=100

cap=350cost=400

cap=500cost=800

CPU0 CPU1 CPU2 CPU3

cap=400cost=700

cap=600cost=1000

cap=800cost=1800

CPU4 CPU5 CPU6 CPU7

cap=1000cost=3000

LITTLE CPUs BIG CPUs

T2

Page 109: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 109

Algorithm complexity

T1cap=100

cost=100

cap=350cost=400

cap=500cost=800

CPU0 CPU1 CPU2 CPU3

cap=400cost=700

cap=600cost=1000

cap=800cost=1800

CPU4 CPU5 CPU6 CPU7

cap=1000cost=3000

LITTLE CPUs BIG CPUs

T2

Page 110: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 110

Algorithm complexity

T1cap=100

cost=100

cap=350cost=400

cap=500cost=800

CPU0 CPU1 CPU2 CPU3

cap=400cost=700

cap=600cost=1000

cap=800cost=1800

CPU4 CPU5 CPU6 CPU7

cap=1000cost=3000

LITTLE CPUs BIG CPUs

T2

T2

Page 111: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 111

Algorithm complexity

T1cap=100

cost=100

cap=350cost=400

cap=500cost=800

CPU0 CPU1 CPU2 CPU3

cap=400cost=700

cap=600cost=1000

cap=800cost=1800

CPU4 CPU5 CPU6 CPU7

cap=1000cost=3000

LITTLE CPUs BIG CPUs

T2

T2

Page 112: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 112

Algorithm complexity

T1cap=100

cost=100

cap=350cost=400

cap=500cost=800

CPU0 CPU1 CPU2 CPU3

cap=400cost=700

cap=600cost=1000

cap=800cost=1800

CPU4 CPU5 CPU6 CPU7

cap=1000cost=3000

LITTLE CPUs BIG CPUs

T2

T2

Page 113: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 113

Algorithm complexity

T1cap=100

cost=100

cap=350cost=400

cap=500cost=800

CPU0 CPU1 CPU2 CPU3

cap=400cost=700

cap=600cost=1000

cap=800cost=1800

CPU4 CPU5 CPU6 CPU7

cap=1000cost=3000

LITTLE CPUs BIG CPUs

T2

T2

Page 114: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 114

Algorithm complexity

T1cap=100

cost=100

cap=350cost=400

cap=500cost=800

CPU0 CPU1 CPU2 CPU3

cap=400cost=700

cap=600cost=1000

cap=800cost=1800

CPU4 CPU5 CPU6 CPU7

cap=1000cost=3000

LITTLE CPUs BIG CPUs

T2

T2

Page 115: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 115

Algorithm complexity

T1cap=100

cost=100

cap=350cost=400

cap=500cost=800

CPU0 CPU1 CPU2 CPU3

cap=400cost=700

cap=600cost=1000

cap=800cost=1800

CPU4 CPU5 CPU6 CPU7

cap=1000cost=3000

LITTLE CPUs BIG CPUs

T2

Page 116: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 116

Algorithm complexity

T1cap=100

cost=100

cap=350cost=400

cap=500cost=800

CPU0 CPU1 CPU2 CPU3

cap=400cost=700

cap=600cost=1000

cap=800cost=1800

CPU4 CPU5 CPU6 CPU7

cap=1000cost=3000

LITTLE CPUs BIG CPUs

T2

T2

Page 117: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 117

Algorithm complexity

T1cap=100

cost=100

cap=350cost=400

cap=500cost=800

CPU0 CPU1 CPU2 CPU3

cap=400cost=700

cap=600cost=1000

cap=800cost=1800

CPU4 CPU5 CPU6 CPU7

cap=1000cost=3000

LITTLE CPUs BIG CPUs

T2

T2

Page 118: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 118

Algorithm complexity

T1cap=100

cost=100

cap=350cost=400

cap=500cost=800

CPU0 CPU1 CPU2 CPU3

cap=400cost=700

cap=600cost=1000

cap=800cost=1800

CPU4 CPU5 CPU6 CPU7

cap=1000cost=3000

LITTLE CPUs BIG CPUs

T2

T2

Page 119: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 119

Algorithm complexity

T1cap=100

cost=100

cap=350cost=400

cap=500cost=800

CPU0 CPU1 CPU2 CPU3

cap=400cost=700

cap=600cost=1000

cap=800cost=1800

CPU4 CPU5 CPU6 CPU7

cap=1000cost=3000

LITTLE CPUs BIG CPUs

T2

T2

Page 120: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 120

Algorithm complexity

T1cap=100

cost=100

cap=350cost=400

cap=500cost=800

CPU0 CPU1 CPU2 CPU3

cap=400cost=700

cap=600cost=1000

cap=800cost=1800

CPU4 CPU5 CPU6 CPU7

cap=1000cost=3000

LITTLE CPUs BIG CPUs

T2

Page 121: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 121

Algorithm complexity

T1cap=100

cost=100

cap=350cost=400

cap=500cost=800

CPU0 CPU1 CPU2 CPU3

cap=400cost=700

cap=600cost=1000

cap=800cost=1800

CPU4 CPU5 CPU6 CPU7

cap=1000cost=3000

LITTLE CPUs BIG CPUs

T2

T2

Page 122: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 122

Algorithm complexity

T1cap=100

cost=100

cap=350cost=400

cap=500cost=800

CPU0 CPU1 CPU2 CPU3

cap=400cost=700

cap=600cost=1000

cap=800cost=1800

CPU4 CPU5 CPU6 CPU7

cap=1000cost=3000

LITTLE CPUs BIG CPUs

T2

T2

Page 123: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 123

Algorithm complexity

T1cap=100

cost=100

cap=350cost=400

cap=500cost=800

CPU0 CPU1 CPU2 CPU3

cap=400cost=700

cap=600cost=1000

cap=800cost=1800

CPU4 CPU5 CPU6 CPU7

cap=1000cost=3000

LITTLE CPUs BIG CPUs

T2

T2

Page 124: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 124

Algorithm complexity

T1cap=100

cost=100

cap=350cost=400

cap=500cost=800

CPU0 CPU1 CPU2 CPU3

cap=400cost=700

cap=600cost=1000

cap=800cost=1800

CPU4 CPU5 CPU6 CPU7

cap=1000cost=3000

LITTLE CPUs BIG CPUs

T2

T2

Page 125: EAS in Android Common Kernelconnect.linaro.org.s3.amazonaws.com/hkg18/presentations/hkg18-501.pdf · • android-4.4-eas-test (android-4.9-eas-test later) • Test branch is against

© 2017 Arm Limited 125

Algorithm complexity

T1cap=100

cost=100

cap=350cost=400

cap=500cost=800

CPU0 CPU1 CPU2 CPU3

cap=400cost=700

cap=600cost=1000

cap=800cost=1800

CPU4 CPU5 CPU6 CPU7

cap=1000cost=3000

LITTLE CPUs BIG CPUs

T2

T2