Re: sched: odd values for effective load calculations
From: Peter Zijlstra
Date: Tue Dec 16 2014 - 10:38:14 EST
On Tue, Dec 16, 2014 at 12:29:28AM -0500, Sasha Levin wrote:
> On 12/15/2014 08:14 AM, Peter Zijlstra wrote:
> > Pinning my hopes on that reproducability thing :/
>
> Okay, yeah, it's very reproducible. I've added:
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index df2cdf7..e1fbe1a 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -4486,7 +4486,7 @@ static int wake_wide(struct task_struct *p)
>
> static int wake_affine(struct sched_domain *sd, struct task_struct *p, int sync)
> {
> - s64 this_load, load;
> + s64 this_load, load, tmps;
> s64 this_eff_load, prev_eff_load;
> int idx, this_cpu, prev_cpu;
> struct task_group *tg;
> @@ -4538,6 +4538,9 @@ static int wake_affine(struct sched_domain *sd, struct task_struct *p, int sync)
> prev_eff_load *= capacity_of(this_cpu);
>
> if (this_load > 0) {
> + if (__builtin_mul_overflow(this_eff_load, this_load +
> + effective_load(tg, this_cpu, weight, weight), &tmps))
> + printk(KERN_CRIT "%lld %lld %lld", this_eff_load, this_load, effective_load(tg, this_cpu, weight, weight));
> this_eff_load *= this_load +
> effective_load(tg, this_cpu, weight, weight);
Minor nit: in general it would be recommend to evaluate effective_load()
once, not thrice, state might have changed in between the calls and
results might differ. Still..
> And got:
>
> [ 437.511964] 91600 1765238667340524 81
> So it's actually 'this_load' going bananas.
That is indeed a fairly strong indication its not effective_load(),
which is good, since that's one hairy piece of cra^Wcode.
Lemme go ponder about this_load.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/