lkml.org 
[lkml]   [2009]   [Mar]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Fix fixpoint divide exception in acct_update_integrals
On Mon, 9 Mar 2009 13:31:59 +0100
Heiko Carstens <heiko.carstens@de.ibm.com> wrote:

> ...
>
> --- linux-2.6.orig/kernel/tsacct.c
> +++ linux-2.6/kernel/tsacct.c
> @@ -122,8 +122,10 @@ void acct_update_integrals(struct task_s
> if (likely(tsk->mm)) {
> cputime_t time, dtime;
> struct timeval value;
> + unsigned long flags;
> u64 delta;
>
> + local_irq_save(flags);
> time = tsk->stime + tsk->utime;
> dtime = cputime_sub(time, tsk->acct_timexpd);
> jiffies_to_timeval(cputime_to_jiffies(dtime), &value);
> @@ -131,10 +133,12 @@ void acct_update_integrals(struct task_s
> delta = delta * USEC_PER_SEC + value.tv_usec;
>
> if (delta == 0)
> - return;
> + goto out;
> tsk->acct_timexpd = time;
> tsk->acct_rss_mem1 += delta * get_mm_rss(tsk->mm);
> tsk->acct_vm_mem1 += delta * tsk->mm->total_vm;
> + out:
> + local_irq_restore(flags);
> }
> }
>

hrm, so we use local-interrupt protection for <something>.

I wonder what we can do to reduce the probability of bugs of this
nature being introduced in the future?



\
 
 \ /
  Last update: 2009-03-09 23:05    [W:0.024 / U:17.988 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site