Re: bug in thread_group_times (+possible patch)
From: Hillf Danton
Date: Sat Mar 10 2012 - 23:10:32 EST
Hello Fawzi,
On Sun, Mar 11, 2012 at 7:11 AM, Fawzi Mohamed <fawzi@xxxxxx> 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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/