diff -Naur 2.5.67-BK-9-4-2003/Makefile 2.5.67-BK-9-4-2003-wakey2/Makefile --- 2.5.67-BK-9-4-2003/Makefile 2003-04-15 13:42:53.000000000 -0700 +++ 2.5.67-BK-9-4-2003-wakey2/Makefile 2003-04-15 13:57:14.000000000 -0700 @@ -1,7 +1,7 @@ VERSION = 2 PATCHLEVEL = 5 SUBLEVEL = 67 -EXTRAVERSION = -BK-9-4-2003 +EXTRAVERSION = -BK-9-4-2003-wakey2 # *DOCUMENTATION* # To see a list of typical targets execute "make help" diff -Naur 2.5.67-BK-9-4-2003/kernel/sched.c 2.5.67-BK-9-4-2003-wakey2/kernel/sched.c --- 2.5.67-BK-9-4-2003/kernel/sched.c 2003-04-13 15:04:34.000000000 -0700 +++ 2.5.67-BK-9-4-2003-wakey2/kernel/sched.c 2003-04-15 14:00:01.000000000 -0700 @@ -486,11 +486,32 @@ */ static int try_to_wake_up(task_t * p, unsigned int state, int sync) { - int success = 0, requeue_waker = 0; - unsigned long flags; + int success = 0, target_cpu, i; + unsigned long flags, cpumask; long old_state; runqueue_t *rq; + target_cpu = smp_processor_id(); + + /* change task_cpu to an idle cpu if its + * default rq is really busy and sync + * wakeup is not requested */ + if (!sync && ((nr_running()*4) <= (num_online_cpus()*5)) && + (task_rq(p)->nr_running > 0)) { + cpumask = node_to_cpumask(cpu_to_node(task_cpu(p))); + for (i=0; istate; @@ -501,43 +522,25 @@ * currently. Do not violate hard affinity. */ if (unlikely(sync && !task_running(rq, p) && - (task_cpu(p) != smp_processor_id()) && - (p->cpus_allowed & (1UL << smp_processor_id())))) { + (task_cpu(p) != target_cpu) && + (p->cpus_allowed & (1UL << target_cpu)))) { - set_task_cpu(p, smp_processor_id()); + set_task_cpu(p, target_cpu); task_rq_unlock(rq, &flags); goto repeat_lock_task; } if (old_state == TASK_UNINTERRUPTIBLE) rq->nr_uninterruptible--; - if (sync) - __activate_task(p, rq); - else { - requeue_waker = activate_task(p, rq); - if (p->prio < rq->curr->prio) + activate_task(p, rq); + + if (p->prio < rq->curr->prio) resched_task(rq->curr); - } success = 1; } p->state = TASK_RUNNING; } task_rq_unlock(rq, &flags); - /* - * We have to do this outside the other spinlock, the two - * runqueues might be different: - */ - if (requeue_waker) { - prio_array_t *array; - - rq = task_rq_lock(current, &flags); - array = current->array; - dequeue_task(current, array); - current->prio = effective_prio(current); - enqueue_task(current, array); - task_rq_unlock(rq, &flags); - } - return success; }