aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Williams <pwil3058@bigpond.net.au>2006-12-18 21:48:50 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-21 03:11:51 -0500
commitbc947631d1d532c758f8fcbdeb1f7fc2f4c863f8 (patch)
tree3795bf4735650e4a1af417f7c97f1d7103401308
parent136f1e7a8cb7d17ff91706518549697071640ae4 (diff)
[PATCH] sched: improve efficiency of sched_fork()
Problem: sched_fork() has always called scheduler_tick() in some (unlikely) circumstances in order to update the current task in light of those circumstances. It has always been the case that the work done by scheduler_tick() was more than was required to handle the problem in hand but no harm was done except for the waste of a few CPU cycles. However, the splitting of scheduler_tick() into two procedures in 2.6.20-rc1 enables the wasted cycles to be saved as the new procedure task_running_tick() does all the work that is required to rectify the problem being handled. Solution: Replace the call to scheduler_tick() in sched_fork() with a call to task_running_tick(). Signed-off-by: Peter Williams <pwil3058@bigpond.com.au> Acked-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--kernel/sched.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index 5cd833bc2173..b81ed8703f70 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -1567,6 +1567,7 @@ int fastcall wake_up_state(struct task_struct *p, unsigned int state)
1567 return try_to_wake_up(p, state, 0); 1567 return try_to_wake_up(p, state, 0);
1568} 1568}
1569 1569
1570static void task_running_tick(struct rq *rq, struct task_struct *p);
1570/* 1571/*
1571 * Perform scheduler related setup for a newly forked process p. 1572 * Perform scheduler related setup for a newly forked process p.
1572 * p is forked by current. 1573 * p is forked by current.
@@ -1627,7 +1628,7 @@ void fastcall sched_fork(struct task_struct *p, int clone_flags)
1627 * runqueue lock is not a problem. 1628 * runqueue lock is not a problem.
1628 */ 1629 */
1629 current->time_slice = 1; 1630 current->time_slice = 1;
1630 scheduler_tick(); 1631 task_running_tick(cpu_rq(cpu), current);
1631 } 1632 }
1632 local_irq_enable(); 1633 local_irq_enable();
1633 put_cpu(); 1634 put_cpu();