mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Sasha Levin <sasha.levin@oracle.com>
Cc: Ingo Molnar <mingo@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Dave Jones <davej@redhat.com>,
	Andrey Ryabinin <a.ryabinin@samsung.com>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: sched: odd values for effective load calculations
Date: Tue, 16 Dec 2014 16:37:55 +0100	[thread overview]
Message-ID: <20141216153755.GB3337@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <548FC338.4050409@oracle.com>

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.

  reply	other threads:[~2014-12-16 15:38 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-02 22:53 Sasha Levin
2014-12-13  8:30 ` Ingo Molnar
2014-12-15 12:12   ` Peter Zijlstra
2014-12-15 13:14     ` Peter Zijlstra
2014-12-16  5:29       ` Sasha Levin
2014-12-16 15:37         ` Peter Zijlstra [this message]
2014-12-18  2:10         ` Yuyang Du
2014-12-16  4:51     ` Sasha Levin
2014-12-16  2:09       ` Yuyang Du
2014-12-19  0:29         ` Yuyang Du
2014-12-19 11:20           ` Peter Zijlstra
2015-01-09 12:33           ` [tip:sched/urgent] sched: Fix odd values in effective_load() calculations tip-bot for Yuyang Du
2014-12-16 15:33       ` sched: odd values for effective load calculations Peter Zijlstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141216153755.GB3337@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=a.ryabinin@samsung.com \
    --cc=davej@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=sasha.levin@oracle.com \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome