mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: torvalds@linux-foundation.org, elendil@planet.nl,
	schwidefsky@de.ibm.com, linux-kernel@vger.kernel.org,
	stable@kernel.org
Subject: Re: [PATCH] Fix fixpoint divide exception in acct_update_integrals
Date: Mon, 9 Mar 2009 15:01:11 -0700	[thread overview]
Message-ID: <20090309150111.c36c54f7.akpm@linux-foundation.org> (raw)
In-Reply-To: <20090309133159.1ef09c7b@osiris.boeblingen.de.ibm.com>

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?


      reply	other threads:[~2009-03-09 22:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-09 12:31 Heiko Carstens
2009-03-09 22:01 ` Andrew Morton [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=20090309150111.c36c54f7.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=elendil@planet.nl \
    --cc=heiko.carstens@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=schwidefsky@de.ibm.com \
    --cc=stable@kernel.org \
    --cc=torvalds@linux-foundation.org \
    /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®