mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [parch] sched: task_times() explosion avoidance for tasks with > 2^32 acrued ticks
@ 2012-08-06 13:58 Mike Galbraith
  2012-08-07  6:30 ` Mike Galbraith
  0 siblings, 1 reply; 4+ messages in thread
From: Mike Galbraith @ 2012-08-06 13:58 UTC (permalink / raw)
  To: LKML; +Cc: Peter Zijlstra


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..0ac2cac 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -3151,7 +3151,7 @@ void task_times(struct task_struct *p, cputime_t *ut, cputime_t *st)
 	 */
 	rtime = nsecs_to_cputime(p->se.sum_exec_runtime);
 
-	if (total) {
+	if (total && total == (__force u32) total) {
 		u64 temp = (__force u64) rtime;
 
 		temp *= (__force u64) utime;
@@ -3184,7 +3184,7 @@ void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *st)
 	total = cputime.utime + cputime.stime;
 	rtime = nsecs_to_cputime(cputime.sum_exec_runtime);
 
-	if (total) {
+	if (total && total == (__force u32) total) {
 		u64 temp = (__force u64) rtime;
 
 		temp *= (__force u64) cputime.utime;



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-08-13 16:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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