aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched.c
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2008-09-20 17:38:02 -0400
committerIngo Molnar <mingo@elte.hu>2008-09-22 10:28:32 -0400
commit15afe09bf496ae10c989e1a375a6b5da7bd3e16e (patch)
tree4565659d1084e357eea42e6321a4d304ac950faa /kernel/sched.c
parent09b22a2f678ae733801b888c44756d0abd686b8a (diff)
sched: wakeup preempt when small overlap
Lin Ming reported a 10% OLTP regression against 2.6.27-rc4. The difference seems to come from different preemption agressiveness, which affects the cache footprint of the workload and its effective cache trashing. Aggresively preempt a task if its avg overlap is very small, this should avoid the task going to sleep and find it still running when we schedule back to it - saving a wakeup. Reported-by: Lin Ming <ming.m.lin@intel.com> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/sched.c')
-rw-r--r--kernel/sched.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index 0d8905a1b8ca..ad9d39b021f8 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -604,9 +604,9 @@ struct rq {
604 604
605static DEFINE_PER_CPU_SHARED_ALIGNED(struct rq, runqueues); 605static DEFINE_PER_CPU_SHARED_ALIGNED(struct rq, runqueues);
606 606
607static inline void check_preempt_curr(struct rq *rq, struct task_struct *p) 607static inline void check_preempt_curr(struct rq *rq, struct task_struct *p, int sync)
608{ 608{
609 rq->curr->sched_class->check_preempt_curr(rq, p); 609 rq->curr->sched_class->check_preempt_curr(rq, p, sync);
610} 610}
611 611
612static inline int cpu_of(struct rq *rq) 612static inline int cpu_of(struct rq *rq)
@@ -2282,7 +2282,7 @@ out_running:
2282 trace_mark(kernel_sched_wakeup, 2282 trace_mark(kernel_sched_wakeup,
2283 "pid %d state %ld ## rq %p task %p rq->curr %p", 2283 "pid %d state %ld ## rq %p task %p rq->curr %p",
2284 p->pid, p->state, rq, p, rq->curr); 2284 p->pid, p->state, rq, p, rq->curr);
2285 check_preempt_curr(rq, p); 2285 check_preempt_curr(rq, p, sync);
2286 2286
2287 p->state = TASK_RUNNING; 2287 p->state = TASK_RUNNING;
2288#ifdef CONFIG_SMP 2288#ifdef CONFIG_SMP
@@ -2417,7 +2417,7 @@ void wake_up_new_task(struct task_struct *p, unsigned long clone_flags)
2417 trace_mark(kernel_sched_wakeup_new, 2417 trace_mark(kernel_sched_wakeup_new,
2418 "pid %d state %ld ## rq %p task %p rq->curr %p", 2418 "pid %d state %ld ## rq %p task %p rq->curr %p",
2419 p->pid, p->state, rq, p, rq->curr); 2419 p->pid, p->state, rq, p, rq->curr);
2420 check_preempt_curr(rq, p); 2420 check_preempt_curr(rq, p, 0);
2421#ifdef CONFIG_SMP 2421#ifdef CONFIG_SMP
2422 if (p->sched_class->task_wake_up) 2422 if (p->sched_class->task_wake_up)
2423 p->sched_class->task_wake_up(rq, p); 2423 p->sched_class->task_wake_up(rq, p);
@@ -2877,7 +2877,7 @@ static void pull_task(struct rq *src_rq, struct task_struct *p,
2877 * Note that idle threads have a prio of MAX_PRIO, for this test 2877 * Note that idle threads have a prio of MAX_PRIO, for this test
2878 * to be always true for them. 2878 * to be always true for them.
2879 */ 2879 */
2880 check_preempt_curr(this_rq, p); 2880 check_preempt_curr(this_rq, p, 0);
2881} 2881}
2882 2882
2883/* 2883/*
@@ -6007,7 +6007,7 @@ static int __migrate_task(struct task_struct *p, int src_cpu, int dest_cpu)
6007 set_task_cpu(p, dest_cpu); 6007 set_task_cpu(p, dest_cpu);
6008 if (on_rq) { 6008 if (on_rq) {
6009 activate_task(rq_dest, p, 0); 6009 activate_task(rq_dest, p, 0);
6010 check_preempt_curr(rq_dest, p); 6010 check_preempt_curr(rq_dest, p, 0);
6011 } 6011 }
6012done: 6012done:
6013 ret = 1; 6013 ret = 1;