Re: Divide-by-zero in the 2.6.23 scheduler code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[ 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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux