bug in sched.c:activate_task()
Quoted 4 lines · Chen, Kenneth W
Update
p->timestampto "now" inactivate_task()doesn't look right to me at all.p->timestamprecords last time it was running on a cpu.activate_taskshouldn't update that variable when it queues a task on the runqueue.
Ingo Molnar wrote on Tuesday, October 05, 2004 1:19 AM
Quoted 19 lines
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:Review static void activate_task(task_t *p, run · line 889
Quoted 3 lines
(quoted diff) +0
-1@@ -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 ofp->timestampis 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).
Quoted 4 lines
the clean solution is to separate the multiple uses of
p->timestamp:
with the patch belowp->timestampis purely used for the interactivity code, andp->last_ranis for the rebalancer. The patch is ontop of yourtask_hot()fix-patch. Does this work for your workload?
Chen, Kenneth W wrote on Tuesday, October 05, 2004 10:45 AM
Quoted 1 line
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