mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Dmitry Adamushko" <dmitry.adamushko@gmail.com>
To: "Ingo Molnar" <mingo@elte.hu>
Cc: "Peter Zijlstra" <a.p.zijlstra@chello.nl>,
	"Chuck Ebbert" <cebbert@redhat.com>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: Divide-by-zero in the 2.6.23 scheduler code
Date: Wed, 14 Nov 2007 15:06:49 +0100	[thread overview]
Message-ID: <b647ffbd0711140606r3e258c33v287875db06138a07@mail.gmail.com> (raw)
In-Reply-To: <20071114135605.GC3739@elte.hu>

[ forwarded to the list ]

so far, just a brief inspection below...

>
> The divide-by-zero is here in kernel/sched.c:
> [ ... ]
>
>         fair_delta64 = ls->delta_fair + 1;
>         ls->delta_fair = 0;
>
>         exec_delta64 = ls->delta_exec + 1;
>         ls->delta_exec = 0;
>
>         sample_interval64 = this_rq->clock - ls->load_update_last;
>         ls->load_update_last = this_rq->clock;
>
>         if ((s64)sample_interval64 < (s64)TICK_NSEC)
>                 sample_interval64 = TICK_NSEC;
>
>         if (exec_delta64 > sample_interval64)
>                 exec_delta64 = sample_interval64;
>
>         idle_delta64 = sample_interval64 - exec_delta64;
>
> ======> tmp64 = div64_64(SCHED_LOAD_SCALE * exec_delta64, fair_delta64);

fair_delta64 == 0
and
fair_delta64 == ls->delta_fair + 1;

so obviously, i.e. ls->delta_fair == -1. delta_fair is of 'insigned
long' and calculated in

__update_curr_load() by means of calc_delta_mine().

calc_delta_mine() does in the very end:

return (unsigned long)min(tmp, (u64)(unsigned long)LONG_MAX);

(*) so that means, we likely got 'tmp' > (unsigned long)LONG_MAX in
calc_delta_mine()...

btw.,

- fair_delta64 == ls->delta_fair + 1;
+ fair_delta64 == (u64)ls->delta_fair + 1;

in update_cpu_load() would avoid the problem, I guess (and perhaps,
can be legitimate, logically-wise).

maybe on the system with low HZ value (I can't see the kernel config
immediately on the bugzilla page) and a task niced to the lowest
priority (is this 'kjournald' mentioned in the report of lower prio? )
running for a full tick, 'tmp' can be such a big value... hmm?


-- 
Best regards,
Dmitry Adamushko

      reply	other threads:[~2007-11-14 14:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-14  1:14 Chuck Ebbert
2007-11-14 13:27 ` Peter Zijlstra
2007-11-14 13:56   ` Ingo Molnar
2007-11-14 14:06     ` Dmitry Adamushko [this message]

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=b647ffbd0711140606r3e258c33v287875db06138a07@mail.gmail.com \
    --to=dmitry.adamushko@gmail.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=cebbert@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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

all inboxes | Powered by JetHome®