[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <xm2638bjlgs5.fsf@sword-of-the-dawn.mtv.corp.google.com>
Date: Mon, 22 Sep 2014 10:13:46 -0700
From: bsegall@...gle.com
To: Morten Rasmussen <morten.rasmussen@....com>
Cc: peterz@...radead.org, mingo@...hat.com, dietmar.eggemann@....com,
pjt@...gle.com, vincent.guittot@...aro.org,
nicolas.pitre@...aro.org, mturquette@...aro.org, rjw@...ysocki.net,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 6/7] sched: Make sched entity usage tracking scale-invariant
Morten Rasmussen <morten.rasmussen@....com> writes:
> Apply scale-invariance correction factor to usage tracking as well.
It seems like it would make more sense to order the patches as first the
usage tracking and then all of the scale-invariance together, or perhaps
to just fold this into the usage tracking patch.
>
> cc: Paul Turner <pjt@...gle.com>
> cc: Ben Segall <bsegall@...gle.com>
>
> Signed-off-by: Morten Rasmussen <morten.rasmussen@....com>
> ---
> kernel/sched/fair.c | 28 ++++++++++++++++------------
> 1 file changed, 16 insertions(+), 12 deletions(-)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index d8a8c83..c7aa8c1 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -2302,9 +2302,9 @@ static __always_inline int __update_entity_runnable_avg(u64 now, int cpu,
> int runnable,
> int running)
> {
> - u64 delta, periods;
> - u32 runnable_contrib;
> - int delta_w, decayed = 0;
> + u64 delta, scaled_delta, periods;
> + u32 runnable_contrib, scaled_runnable_contrib;
> + int delta_w, scaled_delta_w, decayed = 0;
> u32 scale_cap = arch_scale_load_capacity(cpu);
>
> delta = now - sa->last_runnable_update;
> @@ -2339,11 +2339,12 @@ static __always_inline int __update_entity_runnable_avg(u64 now, int cpu,
> */
> delta_w = 1024 - delta_w;
>
> + scaled_delta_w = (delta_w * scale_cap) >> SCHED_CAPACITY_SHIFT;
> +
> if (runnable)
> - sa->runnable_avg_sum += (delta_w * scale_cap)
> - >> SCHED_CAPACITY_SHIFT;
> + sa->runnable_avg_sum += scaled_delta_w;
> if (running)
> - sa->usage_avg_sum += delta_w;
> + sa->usage_avg_sum += scaled_delta_w;
> sa->runnable_avg_period += delta_w;
>
> delta -= delta_w;
> @@ -2361,20 +2362,23 @@ static __always_inline int __update_entity_runnable_avg(u64 now, int cpu,
> /* Efficiently calculate \sum (1..n_period) 1024*y^i */
> runnable_contrib = __compute_runnable_contrib(periods);
>
> - if (runnable)
> - sa->runnable_avg_sum += (runnable_contrib * scale_cap)
> + scaled_runnable_contrib = (runnable_contrib * scale_cap)
> >> SCHED_CAPACITY_SHIFT;
> +
> + if (runnable)
> + sa->runnable_avg_sum += scaled_runnable_contrib;
> if (running)
> - sa->usage_avg_sum += runnable_contrib;
> + sa->usage_avg_sum += scaled_runnable_contrib;
> sa->runnable_avg_period += runnable_contrib;
> }
>
> /* Remainder of delta accrued against u_0` */
> + scaled_delta = (delta * scale_cap) >> SCHED_CAPACITY_SHIFT;
> +
> if (runnable)
> - sa->runnable_avg_sum += (delta * scale_cap)
> - >> SCHED_CAPACITY_SHIFT;
> + sa->runnable_avg_sum += scaled_delta;
> if (running)
> - sa->usage_avg_sum += delta;
> + sa->usage_avg_sum += scaled_delta;
> sa->runnable_avg_period += delta;
>
> return decayed;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists