Create rebalance_domains() from rebalance_tick(). Essentially rebalance_domains = rebalance_tick. However, we do the idle calculation on our own. This removes some processing from scheduler_tick into rebalance_domains(). Signed-off-by: Christoph Lameter Index: linux-2.6.19-rc3/kernel/sched.c =================================================================== --- linux-2.6.19-rc3.orig/kernel/sched.c 2006-10-27 12:52:02.436697548 -0500 +++ linux-2.6.19-rc3/kernel/sched.c 2006-10-27 12:56:34.727358115 -0500 @@ -2841,16 +2841,17 @@ static void update_load(struct rq *this_ } /* - * rebalance_tick will get called every timer tick, on every CPU. + * rebalance_domains is called from the scheduler_tick. * * It checks each scheduling domain to see if it is due to be balanced, * and initiates a balancing operation if so. * * Balancing parameters are set up in arch_init_sched_domains. */ -static void -rebalance_tick(int this_cpu, struct rq *this_rq) +static void rebalance_domains(unsigned long dummy) { + int this_cpu = smp_processor_id(); + struct rq *this_rq = cpu_rq(this_cpu); struct sched_domain *sd; /* * A task is idle if this is the idle queue @@ -2892,37 +2893,26 @@ rebalance_tick(int this_cpu, struct rq * /* * on UP we do not need to balance between CPUs: */ -static inline void rebalance_tick(int cpu, struct rq *rq) -{ -} static inline void idle_balance(int cpu, struct rq *rq) { } -static inline void update_load(struct rq *this_rq) -{ -} #endif -static inline int wake_priority_sleeper(struct rq *rq) +static inline void wake_priority_sleeper(struct rq *rq) { - int ret = 0; - #ifdef CONFIG_SCHED_SMT if (!rq->nr_running) - return 0; + return; spin_lock(&rq->lock); /* * If an SMT sibling task has been put to sleep for priority * reasons reschedule the idle task to see if it can now run. */ - if (rq->nr_running) { + if (rq->nr_running) resched_task(rq->idle); - ret = 1; - } spin_unlock(&rq->lock); #endif - return ret; } DEFINE_PER_CPU(struct kernel_stat, kstat); @@ -3148,8 +3138,10 @@ void scheduler_tick(void) wake_priority_sleeper(rq); else task_running_tick(rq, p); +#ifdef CONFIG_SMP update_load(rq); - rebalance_tick(cpu, rq); + rebalance_domains(0); +#endif } #ifdef CONFIG_SCHED_SMT