From: tip-bot for Stanislaw Gruszka <sgruszka@redhat.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@redhat.com,
seto.hidetoshi@jp.fujitsu.com, a.p.zijlstra@chello.nl,
redhat-bugzilla@very.puzzling.org, sysman@etherpilot.com,
tglx@linutronix.de, sgruszka@redhat.com, mingo@elte.hu
Subject: [tip:sched/urgent] sched: Fix user time incorrectly accounted as system time on 32-bit
Date: Wed, 15 Sep 2010 10:01:31 GMT [thread overview]
Message-ID: <tip-e75e863dd5c7d96b91ebbd241da5328fc38a78cc@git.kernel.org> (raw)
In-Reply-To: <20100914143513.GB8415@redhat.com>
Commit-ID: e75e863dd5c7d96b91ebbd241da5328fc38a78cc
Gitweb: http://git.kernel.org/tip/e75e863dd5c7d96b91ebbd241da5328fc38a78cc
Author: Stanislaw Gruszka <sgruszka@redhat.com>
AuthorDate: Tue, 14 Sep 2010 16:35:14 +0200
Committer: Ingo Molnar <mingo@elte.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@very.puzzling.org>
Reported-by: Ciriaco Garcia de Celis <sysman@etherpilot.com>
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Cc: <stable@kernel.org> # 2.6.32.19+ (partially) and 2.6.33+
LKML-Reference: <20100914143513.GB8415@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.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
prev parent reply other threads:[~2010-09-15 10:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-14 14:35 [PATCH v2] sched: fix user time incorrectly accounted as system time on 32 bit Stanislaw Gruszka
2010-09-14 14:37 ` Peter Zijlstra
2010-09-15 10:01 ` tip-bot for Stanislaw Gruszka [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=tip-e75e863dd5c7d96b91ebbd241da5328fc38a78cc@git.kernel.org \
--to=sgruszka@redhat.com \
--cc=a.p.zijlstra@chello.nl \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mingo@redhat.com \
--cc=redhat-bugzilla@very.puzzling.org \
--cc=seto.hidetoshi@jp.fujitsu.com \
--cc=sysman@etherpilot.com \
--cc=tglx@linutronix.de \
/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
Powered by JetHome