This fix adds a missing part in the [RFC 07/11].
It will be added in the next version.

Signed-off-by: Vincent Guittot <vincent.guit...@linaro.org>
---
 kernel/sched_fair.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 044ffcc..b3a54f4 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -91,6 +91,8 @@ unsigned int __read_mostly
sysctl_sched_shares_window = 10000000UL;

 static const struct sched_class fair_sched_class;

+static unsigned long __read_mostly max_load_balance_interval = HZ/10;
+
 /**************************************************************
  * CFS operations on generic schedulable entities:
  */
@@ -3887,8 +3889,6 @@ void select_nohz_load_balancer(int stop_tick)

 static DEFINE_SPINLOCK(balancing);

-static unsigned long __read_mostly max_load_balance_interval = HZ/10;
-
 /*
  * Scale the max load_balance interval with the number of CPUs in the system.
  * This trades load-balance latency on larger machines for less cross talk.
-- 
1.7.4.1



On 21 October 2011 18:57, Vincent Guittot <vincent.guit...@linaro.org> wrote:
> With a lot of small tasks, the softirq sched is nearly never called
> when no_hz is enable. The load_balance is mainly called with
> the newly_idle mode which doesn't update the cpu_power.
> Add a next_update field which ensures a maximum update period when
> there is short activity
>
> Signed-off-by: Vincent Guittot <vincent.guit...@linaro.org>
> ---
>  include/linux/sched.h |    1 +
>  kernel/sched_fair.c   |   20 ++++++++++++++------
>  2 files changed, 15 insertions(+), 6 deletions(-)
>
> diff --git a/include/linux/sched.h b/include/linux/sched.h
> index 41d0237..8610921 100644
> --- a/include/linux/sched.h
> +++ b/include/linux/sched.h
> @@ -901,6 +901,7 @@ struct sched_group_power {
>         * single CPU.
>         */
>        unsigned int power, power_orig;
> +       unsigned long next_update;
>  };
>
>  struct sched_group {
> diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
> index bc8ee99..3961876 100644
> --- a/kernel/sched_fair.c
> +++ b/kernel/sched_fair.c
> @@ -2667,6 +2667,11 @@ static void update_group_power(struct sched_domain 
> *sd, int cpu)
>        struct sched_domain *child = sd->child;
>        struct sched_group *group, *sdg = sd->groups;
>        unsigned long power;
> +       unsigned long interval;
> +
> +       interval = msecs_to_jiffies(sd->balance_interval);
> +       interval = clamp(interval, 1UL, max_load_balance_interval);
> +       sdg->sgp->next_update = jiffies + interval;
>
>        if (!child) {
>                update_cpu_power(sd, cpu);
> @@ -2774,12 +2779,15 @@ static inline void update_sg_lb_stats(struct 
> sched_domain *sd,
>         * domains. In the newly idle case, we will allow all the cpu's
>         * to do the newly idle load balance.
>         */
> -       if (idle != CPU_NEWLY_IDLE && local_group) {
> -               if (balance_cpu != this_cpu) {
> -                       *balance = 0;
> -                       return;
> -               }
> -               update_group_power(sd, this_cpu);
> +       if (local_group) {
> +               if (idle != CPU_NEWLY_IDLE) {
> +                       if (balance_cpu != this_cpu) {
> +                               *balance = 0;
> +                               return;
> +                       }
> +                       update_group_power(sd, this_cpu);
> +               } else if (time_after_eq(jiffies, group->sgp->next_update))
> +                       update_group_power(sd, this_cpu);
>        }
>
>        /* Adjust by relative CPU power of the group */
> --
> 1.7.4.1
>
>

_______________________________________________
linaro-dev mailing list
linaro-dev@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-dev

Reply via email to