Energy Aware Scheduling Byungchul Park LG Electronics System S/W - - PowerPoint PPT Presentation

energy aware scheduling byungchul park
SMART_READER_LITE
LIVE PREVIEW

Energy Aware Scheduling Byungchul Park LG Electronics System S/W - - PowerPoint PPT Presentation

Energy Aware Scheduling Byungchul Park LG Electronics System S/W Engineer Kernel Developer Computer Science Physics Dance Outline 2 Basic SMP Load Balancing Per-Entity Load Tracking Attempts for Power Saving Energy Aware


slide-1
SLIDE 1

Energy Aware Scheduling

slide-2
SLIDE 2

Byungchul Park

LG Electronics

System S/W Engineer Kernel Developer Computer Science Physics Dance

slide-3
SLIDE 3

Outline

 Basic SMP Load Balancing  Per-Entity Load Tracking  Attempts for Power Saving  Energy Aware Scheduling

2

slide-4
SLIDE 4

Outline

 Basic SMP Load Balancing  Per-Entity Load Tracking  Attempts for Power Saving  Energy Aware Scheduling

3

slide-5
SLIDE 5

Load Balancing Cases

 When a CPU becomes idle or periodically

  • Migrate tasks from the most loaded CPU to a less loaded CPU

 When a task is fork(2)ed or exec(2)ed

  • Good chance to change task’s CPU, due to its small cache footprint
  • Select the least loaded CPU

 When a task is woken up

  • Select the previous CPU or current CPU if possible
  • Select the least loaded CPU

4

the cpu which the task will run on

slide-6
SLIDE 6

Steps for Load Balancing (Migration)

Original Scheduling

1.

Measure all CPUs’ load

2.

Decide the busiest CPU

3.

Decide the idlest CPU

4.

Migrate tasks from the busiest CPU to the idlest CPU

5

slide-7
SLIDE 7

Load Balancing

6

Who is busiest ?

CPU 0 CPU 1

slide-8
SLIDE 8

Load Balancing

7

Take the load !

CPU 1 CPU 0

slide-9
SLIDE 9

Load Balancing

8

CPU 0 CPU 1

slide-10
SLIDE 10

Steps for Load Balancing (Wakeup)

Original Scheduling

1.

Measure all CPUs’ load

2.

Decide the idlest CPU

3.

Set the woken task’s CPU to the idlest CPU

9

slide-11
SLIDE 11

Load Balancing

10

… wait queues

wake up Who is idlest ?

CPU 0 CPU 1

slide-12
SLIDE 12

Load Balancing

11

… wait queues

wake up Take the load !

CPU 0 CPU 1

slide-13
SLIDE 13

Load Balancing

12

… wait queues CPU 0 CPU 1

slide-14
SLIDE 14

Load Balancing

We have to measure each CPU load What is the CPU load ?

13

slide-15
SLIDE 15

CPU Load

 CPU load = ∑ every task load on the CPU  Task load = a value decided by nice(2)

  • High priority task is considered as a large loaded task
  • Low priority task is considered as a small loaded task

 CPU load average = CPU load * CPU utilization (conceptually)

  • Ultimately used for load balancing
  • More precisely, CPU load * moving averaged CPU utilization

14

low utilized CPU has a small load average high utilized CPU has a large load average

slide-16
SLIDE 16

Moving Average

 A method to get the average for sequential data set  Consider already passed values after reducing its contribution  Useful to track the tendency of values (not instant values)

15

slide-17
SLIDE 17

Moving Average

 Thanks to moving average,

  • Scheduler can track tendency of CPU load,
  • Not only current CPU load at that moment updating it

16

slide-18
SLIDE 18

CPU Load Tracking

17

Task load

slide-19
SLIDE 19

CPU Load Tracking

18

CPU load

slide-20
SLIDE 20

CPU Load Tracking

19

CPU load CPU load average

slide-21
SLIDE 21

CPU Load Tracking

20

CPU load CPU load average Time

slide-22
SLIDE 22

CPU Load Tracking

21

CPU load CPU load average Time

slide-23
SLIDE 23

Outline

 Basic SMP Load Balancing  Per-Entity Load Tracking  Attempts for Power Saving  Energy Aware Scheduling

22

slide-24
SLIDE 24

Per-entity Load Tracking

Developed by Paul Turner

 What is entity?

  • Scheduling unit
  • Basically a task is an entity
  • A task group can be an entity in group scheduling

23

slide-25
SLIDE 25

Per-entity Load Tracking

Developed by Paul Turner

 Before

  • Apply moving average on the CPU utilization
  • Consider CPU’s utilization behavior

 After

  • Apply moving average on the each entity runnable ratio
  • Consider entity’s running(or sleep) behavior

24

task or task group

slide-26
SLIDE 26

Original CPU Load Tracking

25

Time CPU load CPU load average

slide-27
SLIDE 27

Original CPU Load Tracking

26

Time CPU load CPU load average

Entity load

slide-28
SLIDE 28

Per-Entity Load Tracking

27

Entity load

slide-29
SLIDE 29

Per-Entity Load Tracking

28

Entity load Entity load average

slide-30
SLIDE 30

Entity load average

Per-Entity Load Tracking

29

Entity load

slide-31
SLIDE 31

Entity load average

Per-Entity Load Tracking

30

Entity load

Time CPU load average

= = =

slide-32
SLIDE 32

Outline

 Basic SMP Load Balancing  Per-Entity Load Tracking  Attempts for Power Saving  Energy Aware Scheduling

31

slide-33
SLIDE 33

Steps for Load Balancing (Migration)

Power Saving Scheduling

1.

Measure all CPUs’ load

2.

Choose a CPU from available CPUs

3.

Decide the idlest CPU

4.

Migrate tasks from the idlest CPU to the chosen CPU

32

can accommodate additional tasks without

  • verflowing

which CPU is chosen is depending on implementation

slide-34
SLIDE 34

Load Balancing for Power Saving

33

I'm chosen. I will help another CPU go to idle !

CPU 0 CPU 1

slide-35
SLIDE 35

Load Balancing for Power Saving

34

Take the load !

CPU 0 CPU 1

slide-36
SLIDE 36

Load Balancing for Power Saving

35

Empty ! CPU 1 (Idle) CPU 0

slide-37
SLIDE 37

Steps for Load Balancing (Wakeup)

Power Saving Scheduling

1.

Measure all CPUs’ load

2.

Choose a CPU from available CPUs

3.

Set the task’s CPU to the CPU

36

slide-38
SLIDE 38

Load Balancing for Power Saving

37

… wait queues

wake up I'm chosen. I will help another CPU go to idle ! Where should I go ?

CPU 0 CPU 1

I am about to be idle.

slide-39
SLIDE 39

Load Balancing for Power Saving

38

… wait queues

wake up Take the load !

CPU 0 CPU 1

slide-40
SLIDE 40

Load Balancing for Power Saving

39

… wait queues CPU 0 CPU 1

slide-41
SLIDE 41

Load Balancing for Power Saving

40

… wait queues Empty ! CPU 1 (Idle) CPU 0

slide-42
SLIDE 42

Attempts for Power Saving

 Accelerated by “per-entity load tracking” patch  Important for Big.LITTLE and server farm environment  Trade off between performance and power saving

41

slide-43
SLIDE 43

Attempts for Power Saving

 T

  • prevent performance regression
  • Perform power saving load balancing,
  • nly when the system is not busy
  • Perform original load balancing,

when the system is busy,

42

slide-44
SLIDE 44

Small Task Packing

Developed by Vincent Guittot

 Goal

  • Pack tasks to fewer CPUs so that more CPUs can be idle
  • achieved by modifying original load balancing

 How

  • Migrate tasks to a CPU not sharing hardware power line
  • Kernel cannot put an empty CPU to a deep idle state

if it shares hardware power line with busy CPU

43

small task is a task used to sleep for more than 75%

slide-45
SLIDE 45

Power Awareness Scheduling

Developed by Alex Shi

 Goal

  • Pack tasks to fewer CPUs so that more CPUs can be idle
  • achieved by modifying original load balancing

 How

  • Migrate tasks to the busiest CPU among available CPUs
  • Not consider hardware power line

44

can accommodate additional tasks without

  • verflowing
slide-46
SLIDE 46

Outline

 Basic SMP Load Balancing  Per-Entity Load Tracking  Attempts for Power Saving  Energy Aware Scheduling

45

slide-47
SLIDE 47

Consider CPU Frequency

 Until now only consider CPU idle  What if consider CPU frequency ?

46

slide-48
SLIDE 48

Consider CPU Frequency

47

CPU frequency Power (mW) highest lowest

slide-49
SLIDE 49

Consider CPU Frequency

48

Take the load ?

CPU 1 CPU 0

slide-50
SLIDE 50

Consider CPU Frequency

49

CPU 0 Empty ! CPU 1 (Idle)

slide-51
SLIDE 51

Consider CPU Frequency

50

Take the load !

CPU 1 CPU 0

slide-52
SLIDE 52

Consider CPU Frequency

51

CPU 0 CPU 1

slide-53
SLIDE 53

Consider CPU Frequency

52

… wait queues

wake up Take the load ?

CPU 0 CPU 1

slide-54
SLIDE 54

Consider CPU Frequency

53

… wait queues CPU 0 CPU 1

slide-55
SLIDE 55

Consider CPU Frequency

54

… wait queues

wake up Take the load !

CPU 0 CPU 1

slide-56
SLIDE 56

Consider CPU Frequency

55

… wait queues CPU 0 CPU 1

slide-57
SLIDE 57

Energy Cost Model

 For saving power consumption,

  • Is it better to pack tasks to fewer CPUs ?
  • Is it better to spread tasks to all CPUs ?

56

slide-58
SLIDE 58

Consider Frequency States

57

CPU frequency Power (mW) CPU frequency Power (mW)

Architecture A Architecture B

highest lowest highest lowest

slide-59
SLIDE 59

Consider Idle States

58

Power (mW)

Architecture A Architecture B

highest lowest shallowest deepest frequency idle Power (mW) highest lowest shallowest deepest frequency idle

slide-60
SLIDE 60

Energy Cost Model

 For saving power consumption,

  • Better to pack tasks to fewer CPUs where

power difference between CPU idle states is large

  • Better to spread tasks to all CPUs where

power difference between CPU frequency states is large

59

slide-61
SLIDE 61

Energy Cost Model

 For saving power consumption, with considering time

  • Better to pack tasks to fewer CPUs where

energy cost difference between CPU idle states is large

  • Better to spread tasks to all CPUs where

energy cost difference between CPU frequency states is large

60

= power integrated by time

slide-62
SLIDE 62

61

OK !

It would be better if it performs the load balancing based on the energy cost

slide-63
SLIDE 63

CPU States (Example)

62

Frequency states

Frequency states Power (mW) highest lowest Power (mW)

Idle states

shallowest deepest Idle states

F E D C B A

slide-64
SLIDE 64

Energy Cost Table (Example)

63

CPU States Energy Cost Description A 300 non-idle + frequency state 0 B 200 non-idle + frequency state 1 C 100 non-idle + frequency state 2 D 50 idle state 1 E 10 idle state 2 F 1 idle state 3

System’s total energy cost = ∑ each CPU energy cost

slide-65
SLIDE 65

64

It looks very simple

to perform the load balancing based on the energy cost

slide-66
SLIDE 66

65

slide-67
SLIDE 67

Modules Related to Energy Cost

 Scheduler

  • Calculate the CPU load in its own way
  • Perform load balancing using the load

 Frequency governor

  • Calculate the CPU utilization in its own way
  • Decide a CPU frequency using the utilization

 Idle governor

  • Track the CPU idle pattern in its own way
  • Decide a proper CPU idle state using the pattern

66

slide-68
SLIDE 68

Modules Related to Energy Cost

 They are working in its own way individually

  • They does not communicate with each other
  • They can conflict with each other easily
  • Changing CPU frequency can affect scheduler load
  • Scheduler does not know the CPU state decided by other modules

67

slide-69
SLIDE 69

Energy Aware Scheduling

68

SOURCE https://www.linaro.org/blog/core-dump/energy-aware-scheduling-eas-project/

slide-70
SLIDE 70

Energy Aware Scheduling

 Integrate the scheduler with CPU frequency states  Integrate the scheduler with CPU idle states  Keep a table describing energy cost for each CPU state  Do load balancing based on the energy cost with the table

69

slide-71
SLIDE 71

CPU Idle State Integration

 Problem

  • Scheduler cannot distinguish between shallow idle states and deep idle states

 Solution

  • To modify the find_idlest_cpu() scheduler function
  • To make it distinguishable between different CPU idle states
  • The function is used when it needs to wake up an idle CPU
  • Now, scheduler can wake up the shallowest idle state CPU

70

slide-72
SLIDE 72

CPU Frequency State Integration

 Problem

  • CPU frequency affects to loads used in scheduler
  • A job needs more time to complete in lower CPU frequency
  • The load should be regarded as smaller in lower CPU frequency
  • Scheduler and frequency governor can conflict with each other easily

 Solution

  • To register the scheduler itself as a frequency governor
  • Scheduler can decide a CPU frequency state directly
  • Scheduler can use the CPU frequency to calculate loads

71

slide-73
SLIDE 73

Steps for EAS Load Balancing

1.

Identify the state of each CPU

2.

Calculate the total energy cost with the states

3.

Migrate tasks so that the cost is minimized

72

= ∑ each CPU energy cost Energy Aware Scheduling

slide-74
SLIDE 74

73

Done

We saved power consumption

slide-75
SLIDE 75

References

74

slide-76
SLIDE 76

THANK YOU

Questions are always welcome,

max.byungchul.park@gmail.com