[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <tip-e75e863dd5c7d96b91ebbd241da5328fc38a78cc@git.kernel.org>
Date: Wed, 15 Sep 2010 10:01:31 GMT
From: tip-bot for Stanislaw Gruszka <sgruszka@...hat.com>
To: linux-tip-commits@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, hpa@...or.com, mingo@...hat.com,
seto.hidetoshi@...fujitsu.com, a.p.zijlstra@...llo.nl,
redhat-bugzilla@...y.puzzling.org, sysman@...erpilot.com,
tglx@...utronix.de, sgruszka@...hat.com, mingo@...e.hu
Subject: [tip:sched/urgent] sched: Fix user time incorrectly accounted as system time on 32-bit
Commit-ID: e75e863dd5c7d96b91ebbd241da5328fc38a78cc
Gitweb: http://git.kernel.org/tip/e75e863dd5c7d96b91ebbd241da5328fc38a78cc
Author: Stanislaw Gruszka <sgruszka@...hat.com>
AuthorDate: Tue, 14 Sep 2010 16:35:14 +0200
Committer: Ingo Molnar <mingo@...e.hu>
CommitDate: Wed, 15 Sep 2010 10:41:36 +0200
sched: Fix user time incorrectly accounted as system time on 32-bit
We have 32-bit variable overflow possibility when multiply in
task_times() and thread_group_times() functions. When the
overflow happens then the scaled utime value becomes erroneously
small and the scaled stime becomes i erroneously big.
Reported here:
https://bugzilla.redhat.com/show_bug.cgi?id=633037
https://bugzilla.kernel.org/show_bug.cgi?id=16559
Reported-by: Michael Chapman <redhat-bugzilla@...y.puzzling.org>
Reported-by: Ciriaco Garcia de Celis <sysman@...erpilot.com>
Signed-off-by: Stanislaw Gruszka <sgruszka@...hat.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc: Hidetoshi Seto <seto.hidetoshi@...fujitsu.com>
Cc: <stable@...nel.org> # 2.6.32.19+ (partially) and 2.6.33+
LKML-Reference: <20100914143513.GB8415@...hat.com>
Signed-off-by: Ingo Molnar <mingo@...e.hu>
---
kernel/sched.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/kernel/sched.c b/kernel/sched.c
index ed09d4f..dc85ceb 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -3513,9 +3513,9 @@ void task_times(struct task_struct *p, cputime_t *ut, cputime_t *st)
rtime = nsecs_to_cputime(p->se.sum_exec_runtime);
if (total) {
- u64 temp;
+ u64 temp = rtime;
- temp = (u64)(rtime * utime);
+ temp *= utime;
do_div(temp, total);
utime = (cputime_t)temp;
} else
@@ -3546,9 +3546,9 @@ void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *st)
rtime = nsecs_to_cputime(cputime.sum_exec_runtime);
if (total) {
- u64 temp;
+ u64 temp = rtime;
- temp = (u64)(rtime * cputime.utime);
+ temp *= cputime.utime;
do_div(temp, total);
utime = (cputime_t)temp;
} else
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists