--- linux-2.6.3-ck1pre/kernel/sched.c 2004-02-16 17:05:07.545898228 +1100 +++ linux-2.6.3-ck1/kernel/sched.c 2004-02-16 17:12:17.059432103 +1100 @@ -1750,7 +1750,7 @@ need_resched: if (SMT_ACTIVE) { /* * If an SMT sibling task is sleeping due to - * priority reasons wake it up now + * priority or batch reasons wake it up now */ runqueue_t *smt_rq; smt_rq = cpu_rq(cpu_sibling_map[(rq->cpu)]); @@ -1806,7 +1806,8 @@ need_resched: * priority task from using an unfair proportion of the * physical cpu's resources. */ - if (next->mm && smt_curr->mm && !rt_task(next) && + if (next->mm && smt_curr->mm && !rt_task(next) && + !batch_task(smt_curr) && ((next->static_prio > smt_curr->static_prio && (smt_curr->time_slice * SMT_SIBLING_IMPACT / 100) > task_timeslice(next)) || rt_task(smt_curr))) { @@ -1815,14 +1816,31 @@ need_resched: } /* - * Reschedule a lower priority task + * Prevent a batch task from running if a user + * non batch task is running on an SMT sibling. + */ + if (unlikely(batch_task(next) && smt_rq->nr_running > + smt_rq->nr_batch)) { + if (smt_curr->mm) { + dequeue_task(next, array); + enqueue_task(next, rq->batch); + next = rq->idle; + } + if (smt_curr == smt_rq->idle) + resched_task(smt_curr); + goto switch_tasks; + } + + /* + * Reschedule a lower priority or batch task * on the SMT sibling, or wake it up if it has been * put to sleep for priority reasons. */ if ((smt_curr != smt_rq->idle && smt_curr->static_prio > next->static_prio) || (rt_task(next) && !rt_task(smt_curr)) || - (smt_curr == smt_rq->idle && smt_rq->nr_running)) + (smt_curr == smt_rq->idle && smt_rq->nr_running) || + (batch_task(smt_curr) && next->mm && !batch_task(next))) resched_task(smt_curr); }