Re: [RFC] Extend mwait idle to optimize away IPIs when possible

From: Yong Zhang
Date: Mon Feb 13 2012 - 00:27:50 EST


On Thu, Feb 09, 2012 at 06:17:06PM -0800, Venki Pallipadi wrote:
>
> This should likely work. But, if you do want to use similar logic in
> smp_call_function() or idle load balance kick etc, you need additional
> bit other than need_resched() as there we only need irq+softirq and
> not necessarily a resched.

Yeah, putting resched_idle_cpu() into smp_call_function_*() is a bit ugly
though resched could work in the scenario because you have
generic_smp_call_function_single_interrupt() called in cpu_idle();

> At this time I am not sure how poll wakeup logic works in MIPS. But,

A typical example is busy loop:
void __noreturn cpu_idle(void)
{
...

while (1) {
tick_nohz_idle_enter();
rcu_idle_enter();
while (!need_resched() && cpu_online(cpu)) {
;
}
rcu_idle_exit();
tick_nohz_idle_exit();
preempt_enable_no_resched();
schedule();
preempt_disable();
}

...
}


> if it is something that is similar to x86 mwait and we can wakeup with
> a bit other than TIF_NEED_RESCHED, we can generalize most of the
> changes in my RFC and share it across archs.

Yeah, there are many things we could share IMHO, especially the hook
in cpu_idle().

Thanks,
Yong
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/