linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike Galbraith <efault@gmx.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: Re: [parch] sched: task_times() explosion avoidance for tasks with > 2^32 acrued ticks
Date: Tue, 07 Aug 2012 08:30:10 +0200	[thread overview]
Message-ID: <1344321010.6968.10.camel@marge.simpson.net> (raw)
In-Reply-To: <1344261539.6853.1.camel@marge.simpson.net>

Wrong xx.

sched: task_times() explosion avoidance for tasks with > 2^32 accrued ticks

If stime + utime > 2^32, and lower 32 are 0 when user calls getrusage(),
you've got a dead box.

Signed-off-by: Mike Galbraith <efault@gmx.de>

 kernel/sched/core.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 82ad284..b0b0d29 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -3155,7 +3155,7 @@ void task_times(struct task_struct *p, cputime_t *ut, cputime_t *st)
 		u64 temp = (__force u64) rtime;
 
 		temp *= (__force u64) utime;
-		do_div(temp, (__force u32) total);
+		temp = div64_u64(temp, (__force u64) total);
 		utime = (__force cputime_t) temp;
 	} else
 		utime = rtime;
@@ -3188,7 +3188,7 @@ void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *st)
 		u64 temp = (__force u64) rtime;
 
 		temp *= (__force u64) cputime.utime;
-		do_div(temp, (__force u32) total);
+		temp = div64_u64(temp, (__force u64) total);
 		utime = (__force cputime_t) temp;
 	} else
 		utime = rtime;



  reply	other threads:[~2012-08-07  6:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-06 13:58 [parch] sched: task_times() explosion avoidance for tasks with > 2^32 acrued ticks Mike Galbraith
2012-08-07  6:30 ` Mike Galbraith [this message]
2012-08-07  8:02   ` [patch] sched,rt: fix isolated CPUs leaving root_task_group indefinitely throttled Mike Galbraith
2012-08-13 16:52     ` [tip:sched/urgent] " tip-bot for Mike Galbraith

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=1344321010.6968.10.camel@marge.simpson.net \
    --to=efault@gmx.de \
    --cc=a.p.zijlstra@chello.nl \
    --cc=linux-kernel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).