sched: aggressive idle balance
Andrew Theurer wrote on Tuesday, November 02, 2004 12:17 PM
Quoted 9 lines
This patch allows more aggressive idle balances, reducing idle time in scenarios where should not be any, where
nr_running>nr_cpus. We have seen this in a couple of online transaction workloads. Three areas are targeted:1) In
try_to_wake_up(),wake_idle()is called to move the task to a sibling if thetask->cpuis busy and the sibling is idle. This has been expanded to any idle cpu, but the closest idle cpu is picked first by starting withcpu->sd, then going up the domains as necessary.
Chen, Kenneth W wrote on Tuesday, November 02, 2004 2:35 PM
Quoted 7 lines
It occurs to me that half of the patch only applicable to HT, like the change in
wake_idle(). And also, do you really want to put that functionality inwake_idle()? Seems defeating the original intention of that function, which only tries to wake up sibling cpu as far as how I understand the code.My setup is 4-way SMP, no HT (4-way itanium2 processor), sorry, I won't be able to tell you how this portion of the change affect online transaction workload.
Move that functionality into try_to_wake_up directly. I'm going to try this on my setup.
sched.c renamed from sched.c.orig +9 -1
@@ -1059,13 +1059,21 @@ static int try_to_wake_up(task_t * p, unschedstat_inc (sd, ttwu_wake_balance); goto out_set_cpu; } + }else if (sd->flags &SD_WAKE_IDLE ) { +cpus_and (tmp, sd->span, cpu_online_map); +cpus_and (tmp, tmp, p->cpus_allowed); +for_each_cpu_mask (i, tmp) { +if (idle_cpu (i)) { + new_cpu = i; + goto out_set_cpu; + } + } } } new_cpu = cpu;/* Could not wake to this_cpu. Wake to cpu instead */ out_set_cpu:schedstat_inc (rq, ttwu_attempts); - new_cpu =wake_idle (new_cpu, p);if (new_cpu != cpu &&cpu_isset (new_cpu, p->cpus_allowed)) {schedstat_inc (rq, ttwu_moved);set_task_cpu (p, new_cpu);