public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [2.6.16-rc6 patch] smp fix for recalc_task_prio()
@ 2006-03-18  4:37 Mike Galbraith
  2006-03-18  4:41 ` Mike Galbraith
  0 siblings, 1 reply; 2+ messages in thread
From: Mike Galbraith @ 2006-03-18  4:37 UTC (permalink / raw)
  To: lkml; +Cc: Ingo Molnar

Greetings,

The patchlet below fixes an smp buglet where a task goes to sleep on one
cpu and wakes up on another, causing recalc_task_prio() to be called
with now < p->timestamp.

If this isn't 2.6.16 material, and I can respin against mm.

	-Mike

--- linux-2.6.16-rc6/kernel/sched.c.org	2006-03-17 14:48:35.000000000 +0100
+++ linux-2.6.16-rc6/kernel/sched.c	2006-03-18 05:22:21.000000000 +0100
@@ -685,6 +685,16 @@
 	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, the timestamp
+	 * is rounded to the nearest tick, which can lead to now
+	 * being less than p->timestamp for short sleeps. Ignore
+	 * these, they're insignificant.
+	 */
+	if (unlikely(now < p->timestamp))
+		__sleep_time = 0ULL;
+
 	if (unlikely(p->policy == SCHED_BATCH))
 		sleep_time = 0;
 	else {




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

* Re: [2.6.16-rc6 patch] smp fix for recalc_task_prio()
  2006-03-18  4:37 [2.6.16-rc6 patch] smp fix for recalc_task_prio() Mike Galbraith
@ 2006-03-18  4:41 ` Mike Galbraith
  0 siblings, 0 replies; 2+ messages in thread
From: Mike Galbraith @ 2006-03-18  4:41 UTC (permalink / raw)
  To: lkml; +Cc: Ingo Molnar

On Sat, 2006-03-18 at 05:37 +0100, Mike Galbraith wrote:
> Greetings,
> 
> The patchlet below fixes an smp buglet where a task goes to sleep on one
> cpu and wakes up on another, causing recalc_task_prio() to be called
> with now < p->timestamp.
> 
> If this isn't 2.6.16 material, and I can respin against mm.

Sigh.  Forgot sob line.

	-Mike

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

--- linux-2.6.16-rc6/kernel/sched.c.org	2006-03-17 14:48:35.000000000 +0100
+++ linux-2.6.16-rc6/kernel/sched.c	2006-03-18 05:22:21.000000000 +0100
@@ -685,6 +685,16 @@
 	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, the timestamp
+	 * is rounded to the nearest tick, which can lead to now
+	 * being less than p->timestamp for short sleeps. Ignore
+	 * these, they're insignificant.
+	 */
+	if (unlikely(now < p->timestamp))
+		__sleep_time = 0ULL;
+
 	if (unlikely(p->policy == SCHED_BATCH))
 		sleep_time = 0;
 	else {



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

end of thread, other threads:[~2006-03-18  4:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-18  4:37 [2.6.16-rc6 patch] smp fix for recalc_task_prio() Mike Galbraith
2006-03-18  4:41 ` Mike Galbraith

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox