public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* bug in sched.c:activate_task()
@ 2004-10-05  2:16 Chen, Kenneth W
  2004-10-05  2:34 ` Con Kolivas
                   ` (3 more replies)
  0 siblings, 4 replies; 18+ messages in thread
From: Chen, Kenneth W @ 2004-10-05  2:16 UTC (permalink / raw)
  To: linux-kernel

Update p->timestamp to "now" in activate_task() doesn't look right
to me at all.  p->timestamp records last time it was running on a
cpu.  activate_task shouldn't update that variable when it queues
a task on the runqueue.

This bug (and combined with others) triggers improper load balancing.

Patch against linux-2.6.9-rc3.  Didn't diff it against 2.6.9-rc3-mm2
because mm tree has so many change in sched.c.

Signed-off-by: Ken Chen <kenneth.w.chen@intel.com>


--- linux-2.6.9-rc3/kernel/sched.c.orig	2004-10-04 19:11:21.000000000 -0700
+++ linux-2.6.9-rc3/kernel/sched.c	2004-10-04 19:11:35.000000000 -0700
@@ -888,7 +888,6 @@ static void activate_task(task_t *p, run
 			p->activated = 1;
 		}
 	}
-	p->timestamp = now;

 	__activate_task(p, rq);
 }



^ permalink raw reply	[flat|nested] 18+ messages in thread
* RE: bug in sched.c:activate_task()
@ 2004-10-05 22:46 Chen, Kenneth W
  0 siblings, 0 replies; 18+ messages in thread
From: Chen, Kenneth W @ 2004-10-05 22:46 UTC (permalink / raw)
  To: 'Ingo Molnar'
  Cc: linux-kernel, 'Andrew Morton', 'Nick Piggin'

* Chen, Kenneth W <kenneth.w.chen@intel.com> wrote:
> Update p->timestamp to "now" in activate_task() doesn't look right to
> me at all.  p->timestamp records last time it was running on a cpu.
> activate_task shouldn't update that variable when it queues a task on
> the runqueue.

Ingo Molnar wrote on Tuesday, October 05, 2004 1:19 AM
> it is being used for multiple purposes: measuring on-CPU time, measuring
> on-runqueue time (for interactivity) and measuring off-runqueue time
> (for interactivity). It is also used to measure cache-hotness, by the
> balancing code.
>
> now, this particular update of p->timestamp:
>
> > @@ -888,7 +888,6 @@ static void activate_task(task_t *p, run
>
> > -	p->timestamp = now;
>
> is important for the interactivity code that runs in schedule() - it
> wants to know how much time we spent on the runqueue without having run.
>
> but you are right that the task_hot() use of p->timestamp is incorrect
> for freshly woken up tasks - we want the balancer to be able to re-route
> tasks to another CPU, as long as the task has not hit the runqueue yet
> (which it hasnt where we consider it in the balancer).
>
> the clean solution is to separate the multiple uses of p->timestamp:
> with the patch below p->timestamp is purely used for the interactivity
> code, and p->last_ran is for the rebalancer. The patch is ontop of your
> task_hot() fix-patch. Does this work for your workload?


Chen, Kenneth W wrote on Tuesday, October 05, 2004 10:45 AM
> I will take this for a spin and report back the result.

Confirmed that Ingo's latest patch does the right thing for the db workload.

- Ken



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

end of thread, other threads:[~2004-10-05 22:47 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-05  2:16 bug in sched.c:activate_task() Chen, Kenneth W
2004-10-05  2:34 ` Con Kolivas
2004-10-05  3:14   ` Nick Piggin
2004-10-05  4:45     ` Con Kolivas
2004-10-05  5:05   ` Peter Williams
2004-10-05  6:10 ` Nick Piggin
2004-10-05  6:31 ` Ingo Molnar
2004-10-05  6:36   ` Con Kolivas
2004-10-05  6:54     ` Ingo Molnar
2004-10-05  6:59       ` Con Kolivas
2004-10-05  7:08         ` Nick Piggin
2004-10-05  7:09         ` Ingo Molnar
2004-10-05 17:30           ` Chen, Kenneth W
2004-10-05 17:25       ` Chen, Kenneth W
2004-10-05  6:57     ` Nick Piggin
2004-10-05  8:19 ` Ingo Molnar
2004-10-05 17:44   ` Chen, Kenneth W
  -- strict thread matches above, loose matches on Subject: below --
2004-10-05 22:46 Chen, Kenneth W

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