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 Scheduling
Outline 3 Basic SMP Load Balancing Per-Entity Load Tracking Attempts for Power Saving Energy Aware Scheduling
Load Balancing Cases 4 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 • the cpu which Select the least loaded CPU • the task will run on When a task is woken up Select the previous CPU or current CPU if possible • Select the least loaded CPU •
Steps for Load Balancing (Migration) Original Scheduling 5 Measure all CPUs’ load 1. Decide the busiest CPU 2. Decide the idlest CPU 3. Migrate tasks from the busiest CPU to the idlest CPU 4.
Load Balancing 6 Who is busiest ? CPU 1 CPU 0
Load Balancing 7 Take the load ! CPU 1 CPU 0
Load Balancing 8 CPU 0 CPU 1
Steps for Load Balancing (Wakeup) Original Scheduling 9 Measure all CPUs’ load 1. Decide the idlest CPU 2. Set the woken task’s CPU to the idlest CPU 3.
Load Balancing 10 Who is idlest ? … wake up wait queues CPU 1 CPU 0
Load Balancing 11 … wake up wait queues Take the load ! CPU 1 CPU 0
Load Balancing 12 … wait queues CPU 0 CPU 1
Load Balancing 13 We have to measure each CPU load What is the CPU load ?
CPU Load 14 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) low utilized CPU has a small load average Ultimately used for load balancing • high utilized CPU has a large load average More precisely, CPU load * moving averaged CPU utilization •
Moving Average 15 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)
Moving Average 16 Thanks to moving average, • Scheduler can track tendency of CPU load, • Not only current CPU load at that moment updating it
CPU Load Tracking 17 Task load
CPU Load Tracking 18 CPU load
CPU Load Tracking 19 CPU load CPU load average
CPU Load Tracking 20 CPU load Time CPU load average
CPU Load Tracking 21 CPU load Time CPU load average
Outline 22 Basic SMP Load Balancing Per-Entity Load Tracking Attempts for Power Saving Energy Aware Scheduling
Per-entity Load Tracking Developed by Paul Turner 23 What is entity? Scheduling unit • Basically a task is an entity • A task group can be an entity in group scheduling •
Per-entity Load Tracking Developed by Paul Turner 24 Before Apply moving average on the CPU utilization • Consider CPU’s utilization behavior • After task or task group Apply moving average on the each entity runnable ratio • Consider entity’s running(or sleep) behavior •
Original CPU Load Tracking 25 CPU load Time CPU load average
Original CPU Load Tracking 26 Entity load CPU load Time CPU load average
Per-Entity Load Tracking 27 Entity load
Per-Entity Load Tracking 28 Entity load Entity load average
Per-Entity Load Tracking 29 Entity load Entity load average
Per-Entity Load Tracking 30 Entity load Entity load average = = = Time CPU load average
Outline 31 Basic SMP Load Balancing Per-Entity Load Tracking Attempts for Power Saving Energy Aware Scheduling
Steps for Load Balancing (Migration) Power Saving Scheduling 32 Measure all CPUs’ load 1. can accommodate which CPU is chosen is additional tasks without depending on implementation overflowing Choose a CPU from available CPUs 2. Decide the idlest CPU 3. Migrate tasks from the idlest CPU to the chosen CPU 4.
Load Balancing for Power Saving 33 I'm chosen. I will help another CPU go to idle ! CPU 1 CPU 0
Load Balancing for Power Saving 34 Take the load ! CPU 1 CPU 0
Load Balancing for Power Saving 35 Empty ! CPU 1 (Idle) CPU 0
Steps for Load Balancing (Wakeup) Power Saving Scheduling 36 Measure all CPUs’ load 1. Choose a CPU from available CPUs 2. Set the task’s CPU to the CPU 3.
Load Balancing for Power Saving 37 Where should I go ? … wake up wait queues I am about to be idle. I'm chosen. I will help another CPU go to idle ! CPU 1 CPU 0
Load Balancing for Power Saving 38 … wake up wait queues Take the load ! CPU 1 CPU 0
Load Balancing for Power Saving 39 … wait queues CPU 1 CPU 0
Load Balancing for Power Saving 40 … wait queues Empty ! CPU 1 (Idle) CPU 0
Attempts for Power Saving 41 Accelerated by “per - entity load tracking” patch Important for Big.LITTLE and server farm environment Trade off between performance and power saving
Attempts for Power Saving 42 T o prevent performance regression • Perform power saving load balancing, only when the system is not busy • Perform original load balancing, when the system is busy,
Small Task Packing small task is a task used to sleep for more than 75% Developed by Vincent Guittot 43 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
Power Awareness Scheduling Developed by Alex Shi 44 Goal Pack tasks to fewer CPUs so that more CPUs can be idle • achieved by modifying original load balancing • How can accommodate additional tasks without overflowing Migrate tasks to the busiest CPU among available CPUs • Not consider hardware power line •
Outline 45 Basic SMP Load Balancing Per-Entity Load Tracking Attempts for Power Saving Energy Aware Scheduling
Consider CPU Frequency 46 Until now only consider CPU idle What if consider CPU frequency ?
Consider CPU Frequency 47 Power (mW) CPU frequency lowest highest
Consider CPU Frequency 48 Take the load ? CPU 1 CPU 0
Consider CPU Frequency 49 Empty ! CPU 1 (Idle) CPU 0
Consider CPU Frequency 50 Take the load ! CPU 1 CPU 0
Consider CPU Frequency 51 CPU 0 CPU 1
Consider CPU Frequency 52 … wake up wait queues Take the load ? CPU 1 CPU 0
Consider CPU Frequency 53 … wait queues CPU 1 CPU 0
Consider CPU Frequency 54 … wake up wait queues Take the load ! CPU 1 CPU 0
Consider CPU Frequency 55 … wait queues CPU 0 CPU 1
Energy Cost Model 56 For saving power consumption, • Is it better to pack tasks to fewer CPUs ? • Is it better to spread tasks to all CPUs ?
Consider Frequency States 57 Power Power (mW) (mW) CPU frequency CPU frequency lowest highest lowest highest Architecture A Architecture B
Consider Idle States 58 Power Power (mW) (mW) idle frequency idle frequency deepest shallowest lowest highest deepest shallowest lowest highest Architecture A Architecture B
Energy Cost Model 59 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
Energy Cost Model 60 For saving power consumption, with considering time • Better to pack tasks to fewer CPUs where energy cost difference between CPU idle states is large = power integrated by time • Better to spread tasks to all CPUs where energy cost difference between CPU frequency states is large
OK ! It would be better if it performs the load balancing based on the energy cost 61
CPU States (Example) 62 Power Power (mW) (mW) A B C D E F Idle states Frequency states deepest shallowest lowest highest Idle states Frequency states
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 S ystem’s total energy cost = ∑ each CPU energy cost
It looks very simple to perform the load balancing based on the energy cost 64
65
Recommend
More recommend