lkml.org 
[lkml]   [2006]   [Apr]   [1]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [patch 2.6.16-mm2 1/9] sched throttle tree extract - ignore invalid timestamps
FromMike Galbraith <>
DateSat, 01 Apr 2006 10:33:17 +0200
On an SMP system, a task can awaken on a different cpu from where it
went to sleep.  Timestamp inaccuracies can result from the attempt to
compensate for clock drift.  Ignore resulting timewarps.

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

--- linux-2.6.16-mm2/kernel/sched.c-0.fix_rt	2006-03-23 15:01:41.000000000 +0100
+++ linux-2.6.16-mm2/kernel/sched.c	2006-03-23 15:02:25.000000000 +0100
@@ -845,6 +845,15 @@ static int recalc_task_prio(task_t *p, u
 	unsigned long long __sleep_time = now - p->timestamp;
 	unsigned long sleep_time;
 
+	/*
+	 * On SMP systems, a task can go to sleep on one CPU
+	 * and wake up on another.  When this happens, now can
+	 * end up being less than p->timestamp for short sleeps.
+	 * Ignore these, they're insignificant.
+	 */
+	if (unlikely(now < p->timestamp))
+		__sleep_time = 0;
+
 	if (batch_task(p))
 		sleep_time = 0;
 	else {

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-04-01 10:35    [from the cache]
©2003-2008