lkml.org 
[lkml]   [2012]   [Mar]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: bug in thread_group_times (+possible patch)
From
Hello Fawzi,

On Sun, Mar 11, 2012 at 7:11 AM, Fawzi Mohamed <fawzi@gmx.ch> wrote:
> Hi,
>
> a friend of mine asked me about a kernel crash that he was having on a linux cluster (always after long compute intensive task).
> I found the bug causing it, and patched it (in an imperfect way), and as I have seen that in the current git the bug is still there, I am writing it here.
> I am not into kernel development, so I did not subscribe to the list, please CC me if you want me to answer.
> Sorry if this is not the correct way, but I hope this might help to squash just another little bug.
>
> Now the bug is in kernel/sched/core.c in thread_group_times which if CONFIG_VIRT_CPU_ACCOUNTING is not defined looks like this
>
> void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *st)
> {
>        struct signal_struct *sig = p->signal;
>        struct task_cputime cputime;
>        cputime_t rtime, utime, total;
>
>        thread_group_cputime(p, &cputime);
>
>        total = cputime.utime + cputime.stime;
>        rtime = nsecs_to_cputime(cputime.sum_exec_runtime);
>
>        if (total) {
>                u64 temp = (__force u64) rtime;
>
>                temp *= (__force u64) cputime.utime;

Would you please try the tiny change?

-                do_div(temp, (__force u32) total);
+               temp = div64_u64(temp, (__force u64) total);

>                utime = (__force cputime_t) temp;
>        } else
>                utime = rtime;
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2012-03-11 05:13    [W:1.018 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site