diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2011-07-14 07:00:06 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2011-07-20 12:32:40 -0400 |
commit | 9c3f75cbd144014bea6af866a154cc2e73ab2287 (patch) | |
tree | 2a565f7ff0820269973415c5605e313cfff903b4 /kernel/sched_fair.c | |
parent | e6625fa48e6580a74b7e700efd7e6463e282810b (diff) |
sched: Break out cpu_power from the sched_group structure
In order to prepare for non-unique sched_groups per domain, we need to
carry the cpu_power elsewhere, so put a level of indirection in.
Reported-and-tested-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Link: http://lkml.kernel.org/n/tip-qkho2byuhe4482fuknss40ad@git.kernel.org
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/sched_fair.c')
-rw-r--r-- | kernel/sched_fair.c | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c index 433491c2dc8f..c768588e180b 100644 --- a/kernel/sched_fair.c +++ b/kernel/sched_fair.c | |||
@@ -1585,7 +1585,7 @@ find_idlest_group(struct sched_domain *sd, struct task_struct *p, | |||
1585 | } | 1585 | } |
1586 | 1586 | ||
1587 | /* Adjust by relative CPU power of the group */ | 1587 | /* Adjust by relative CPU power of the group */ |
1588 | avg_load = (avg_load * SCHED_POWER_SCALE) / group->cpu_power; | 1588 | avg_load = (avg_load * SCHED_POWER_SCALE) / group->sgp->power; |
1589 | 1589 | ||
1590 | if (local_group) { | 1590 | if (local_group) { |
1591 | this_load = avg_load; | 1591 | this_load = avg_load; |
@@ -2631,7 +2631,7 @@ static void update_cpu_power(struct sched_domain *sd, int cpu) | |||
2631 | power >>= SCHED_POWER_SHIFT; | 2631 | power >>= SCHED_POWER_SHIFT; |
2632 | } | 2632 | } |
2633 | 2633 | ||
2634 | sdg->cpu_power_orig = power; | 2634 | sdg->sgp->power_orig = power; |
2635 | 2635 | ||
2636 | if (sched_feat(ARCH_POWER)) | 2636 | if (sched_feat(ARCH_POWER)) |
2637 | power *= arch_scale_freq_power(sd, cpu); | 2637 | power *= arch_scale_freq_power(sd, cpu); |
@@ -2647,7 +2647,7 @@ static void update_cpu_power(struct sched_domain *sd, int cpu) | |||
2647 | power = 1; | 2647 | power = 1; |
2648 | 2648 | ||
2649 | cpu_rq(cpu)->cpu_power = power; | 2649 | cpu_rq(cpu)->cpu_power = power; |
2650 | sdg->cpu_power = power; | 2650 | sdg->sgp->power = power; |
2651 | } | 2651 | } |
2652 | 2652 | ||
2653 | static void update_group_power(struct sched_domain *sd, int cpu) | 2653 | static void update_group_power(struct sched_domain *sd, int cpu) |
@@ -2665,11 +2665,11 @@ static void update_group_power(struct sched_domain *sd, int cpu) | |||
2665 | 2665 | ||
2666 | group = child->groups; | 2666 | group = child->groups; |
2667 | do { | 2667 | do { |
2668 | power += group->cpu_power; | 2668 | power += group->sgp->power; |
2669 | group = group->next; | 2669 | group = group->next; |
2670 | } while (group != child->groups); | 2670 | } while (group != child->groups); |
2671 | 2671 | ||
2672 | sdg->cpu_power = power; | 2672 | sdg->sgp->power = power; |
2673 | } | 2673 | } |
2674 | 2674 | ||
2675 | /* | 2675 | /* |
@@ -2691,7 +2691,7 @@ fix_small_capacity(struct sched_domain *sd, struct sched_group *group) | |||
2691 | /* | 2691 | /* |
2692 | * If ~90% of the cpu_power is still there, we're good. | 2692 | * If ~90% of the cpu_power is still there, we're good. |
2693 | */ | 2693 | */ |
2694 | if (group->cpu_power * 32 > group->cpu_power_orig * 29) | 2694 | if (group->sgp->power * 32 > group->sgp->power_orig * 29) |
2695 | return 1; | 2695 | return 1; |
2696 | 2696 | ||
2697 | return 0; | 2697 | return 0; |
@@ -2771,7 +2771,7 @@ static inline void update_sg_lb_stats(struct sched_domain *sd, | |||
2771 | } | 2771 | } |
2772 | 2772 | ||
2773 | /* Adjust by relative CPU power of the group */ | 2773 | /* Adjust by relative CPU power of the group */ |
2774 | sgs->avg_load = (sgs->group_load*SCHED_POWER_SCALE) / group->cpu_power; | 2774 | sgs->avg_load = (sgs->group_load*SCHED_POWER_SCALE) / group->sgp->power; |
2775 | 2775 | ||
2776 | /* | 2776 | /* |
2777 | * Consider the group unbalanced when the imbalance is larger | 2777 | * Consider the group unbalanced when the imbalance is larger |
@@ -2788,7 +2788,7 @@ static inline void update_sg_lb_stats(struct sched_domain *sd, | |||
2788 | if ((max_cpu_load - min_cpu_load) >= avg_load_per_task && max_nr_running > 1) | 2788 | if ((max_cpu_load - min_cpu_load) >= avg_load_per_task && max_nr_running > 1) |
2789 | sgs->group_imb = 1; | 2789 | sgs->group_imb = 1; |
2790 | 2790 | ||
2791 | sgs->group_capacity = DIV_ROUND_CLOSEST(group->cpu_power, | 2791 | sgs->group_capacity = DIV_ROUND_CLOSEST(group->sgp->power, |
2792 | SCHED_POWER_SCALE); | 2792 | SCHED_POWER_SCALE); |
2793 | if (!sgs->group_capacity) | 2793 | if (!sgs->group_capacity) |
2794 | sgs->group_capacity = fix_small_capacity(sd, group); | 2794 | sgs->group_capacity = fix_small_capacity(sd, group); |
@@ -2877,7 +2877,7 @@ static inline void update_sd_lb_stats(struct sched_domain *sd, int this_cpu, | |||
2877 | return; | 2877 | return; |
2878 | 2878 | ||
2879 | sds->total_load += sgs.group_load; | 2879 | sds->total_load += sgs.group_load; |
2880 | sds->total_pwr += sg->cpu_power; | 2880 | sds->total_pwr += sg->sgp->power; |
2881 | 2881 | ||
2882 | /* | 2882 | /* |
2883 | * In case the child domain prefers tasks go to siblings | 2883 | * In case the child domain prefers tasks go to siblings |
@@ -2962,7 +2962,7 @@ static int check_asym_packing(struct sched_domain *sd, | |||
2962 | if (this_cpu > busiest_cpu) | 2962 | if (this_cpu > busiest_cpu) |
2963 | return 0; | 2963 | return 0; |
2964 | 2964 | ||
2965 | *imbalance = DIV_ROUND_CLOSEST(sds->max_load * sds->busiest->cpu_power, | 2965 | *imbalance = DIV_ROUND_CLOSEST(sds->max_load * sds->busiest->sgp->power, |
2966 | SCHED_POWER_SCALE); | 2966 | SCHED_POWER_SCALE); |
2967 | return 1; | 2967 | return 1; |
2968 | } | 2968 | } |
@@ -2993,7 +2993,7 @@ static inline void fix_small_imbalance(struct sd_lb_stats *sds, | |||
2993 | 2993 | ||
2994 | scaled_busy_load_per_task = sds->busiest_load_per_task | 2994 | scaled_busy_load_per_task = sds->busiest_load_per_task |
2995 | * SCHED_POWER_SCALE; | 2995 | * SCHED_POWER_SCALE; |
2996 | scaled_busy_load_per_task /= sds->busiest->cpu_power; | 2996 | scaled_busy_load_per_task /= sds->busiest->sgp->power; |
2997 | 2997 | ||
2998 | if (sds->max_load - sds->this_load + scaled_busy_load_per_task >= | 2998 | if (sds->max_load - sds->this_load + scaled_busy_load_per_task >= |
2999 | (scaled_busy_load_per_task * imbn)) { | 2999 | (scaled_busy_load_per_task * imbn)) { |
@@ -3007,28 +3007,28 @@ static inline void fix_small_imbalance(struct sd_lb_stats *sds, | |||
3007 | * moving them. | 3007 | * moving them. |
3008 | */ | 3008 | */ |
3009 | 3009 | ||
3010 | pwr_now += sds->busiest->cpu_power * | 3010 | pwr_now += sds->busiest->sgp->power * |
3011 | min(sds->busiest_load_per_task, sds->max_load); | 3011 | min(sds->busiest_load_per_task, sds->max_load); |
3012 | pwr_now += sds->this->cpu_power * | 3012 | pwr_now += sds->this->sgp->power * |
3013 | min(sds->this_load_per_task, sds->this_load); | 3013 | min(sds->this_load_per_task, sds->this_load); |
3014 | pwr_now /= SCHED_POWER_SCALE; | 3014 | pwr_now /= SCHED_POWER_SCALE; |
3015 | 3015 | ||
3016 | /* Amount of load we'd subtract */ | 3016 | /* Amount of load we'd subtract */ |
3017 | tmp = (sds->busiest_load_per_task * SCHED_POWER_SCALE) / | 3017 | tmp = (sds->busiest_load_per_task * SCHED_POWER_SCALE) / |
3018 | sds->busiest->cpu_power; | 3018 | sds->busiest->sgp->power; |
3019 | if (sds->max_load > tmp) | 3019 | if (sds->max_load > tmp) |
3020 | pwr_move += sds->busiest->cpu_power * | 3020 | pwr_move += sds->busiest->sgp->power * |
3021 | min(sds->busiest_load_per_task, sds->max_load - tmp); | 3021 | min(sds->busiest_load_per_task, sds->max_load - tmp); |
3022 | 3022 | ||
3023 | /* Amount of load we'd add */ | 3023 | /* Amount of load we'd add */ |
3024 | if (sds->max_load * sds->busiest->cpu_power < | 3024 | if (sds->max_load * sds->busiest->sgp->power < |
3025 | sds->busiest_load_per_task * SCHED_POWER_SCALE) | 3025 | sds->busiest_load_per_task * SCHED_POWER_SCALE) |
3026 | tmp = (sds->max_load * sds->busiest->cpu_power) / | 3026 | tmp = (sds->max_load * sds->busiest->sgp->power) / |
3027 | sds->this->cpu_power; | 3027 | sds->this->sgp->power; |
3028 | else | 3028 | else |
3029 | tmp = (sds->busiest_load_per_task * SCHED_POWER_SCALE) / | 3029 | tmp = (sds->busiest_load_per_task * SCHED_POWER_SCALE) / |
3030 | sds->this->cpu_power; | 3030 | sds->this->sgp->power; |
3031 | pwr_move += sds->this->cpu_power * | 3031 | pwr_move += sds->this->sgp->power * |
3032 | min(sds->this_load_per_task, sds->this_load + tmp); | 3032 | min(sds->this_load_per_task, sds->this_load + tmp); |
3033 | pwr_move /= SCHED_POWER_SCALE; | 3033 | pwr_move /= SCHED_POWER_SCALE; |
3034 | 3034 | ||
@@ -3074,7 +3074,7 @@ static inline void calculate_imbalance(struct sd_lb_stats *sds, int this_cpu, | |||
3074 | 3074 | ||
3075 | load_above_capacity *= (SCHED_LOAD_SCALE * SCHED_POWER_SCALE); | 3075 | load_above_capacity *= (SCHED_LOAD_SCALE * SCHED_POWER_SCALE); |
3076 | 3076 | ||
3077 | load_above_capacity /= sds->busiest->cpu_power; | 3077 | load_above_capacity /= sds->busiest->sgp->power; |
3078 | } | 3078 | } |
3079 | 3079 | ||
3080 | /* | 3080 | /* |
@@ -3090,8 +3090,8 @@ static inline void calculate_imbalance(struct sd_lb_stats *sds, int this_cpu, | |||
3090 | max_pull = min(sds->max_load - sds->avg_load, load_above_capacity); | 3090 | max_pull = min(sds->max_load - sds->avg_load, load_above_capacity); |
3091 | 3091 | ||
3092 | /* How much load to actually move to equalise the imbalance */ | 3092 | /* How much load to actually move to equalise the imbalance */ |
3093 | *imbalance = min(max_pull * sds->busiest->cpu_power, | 3093 | *imbalance = min(max_pull * sds->busiest->sgp->power, |
3094 | (sds->avg_load - sds->this_load) * sds->this->cpu_power) | 3094 | (sds->avg_load - sds->this_load) * sds->this->sgp->power) |
3095 | / SCHED_POWER_SCALE; | 3095 | / SCHED_POWER_SCALE; |
3096 | 3096 | ||
3097 | /* | 3097 | /* |