mn10300: Use generic idle loop

default_idle() boils down to safe_halt() and the other option is idle
polling. Use the core functionality.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Paul McKenney <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Reviewed-by: Cc: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Cc: Magnus Damm <magnus.damm@gmail.com>
Cc: David Howells <dhowells@redhat.com>
Link: http://lkml.kernel.org/r/20130321215234.822656036@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
This commit is contained in:
Thomas Gleixner 2013-03-21 22:49:53 +01:00
Родитель cdbedc61c8
Коммит af695cd931
3 изменённых файлов: 8 добавлений и 65 удалений

Просмотреть файл

@ -13,6 +13,7 @@ config MN10300
select MODULES_USE_ELF_RELA select MODULES_USE_ELF_RELA
select OLD_SIGSUSPEND3 select OLD_SIGSUSPEND3
select OLD_SIGACTION select OLD_SIGACTION
select GENERIC_IDLE_LOOP
config AM33_2 config AM33_2
def_bool n def_bool n

Просмотреть файл

@ -50,77 +50,19 @@ unsigned long thread_saved_pc(struct task_struct *tsk)
void (*pm_power_off)(void); void (*pm_power_off)(void);
EXPORT_SYMBOL(pm_power_off); EXPORT_SYMBOL(pm_power_off);
#if !defined(CONFIG_SMP) || defined(CONFIG_HOTPLUG_CPU)
/*
* we use this if we don't have any better idle routine
*/
static void default_idle(void)
{
local_irq_disable();
if (!need_resched())
safe_halt();
else
local_irq_enable();
}
#else /* !CONFIG_SMP || CONFIG_HOTPLUG_CPU */
/* /*
* On SMP it's slightly faster (but much more power-consuming!) * On SMP it's slightly faster (but much more power-consuming!)
* to poll the ->work.need_resched flag instead of waiting for the * to poll the ->work.need_resched flag instead of waiting for the
* cross-CPU IPI to arrive. Use this option with caution. * cross-CPU IPI to arrive. Use this option with caution.
*
* tglx: No idea why this depends on HOTPLUG_CPU !?!
*/ */
static inline void poll_idle(void) #if !defined(CONFIG_SMP) || defined(CONFIG_HOTPLUG_CPU)
void arch_cpu_idle(void)
{ {
int oldval; safe_halt();
local_irq_enable();
/*
* Deal with another CPU just having chosen a thread to
* run here:
*/
oldval = test_and_clear_thread_flag(TIF_NEED_RESCHED);
if (!oldval) {
set_thread_flag(TIF_POLLING_NRFLAG);
while (!need_resched())
cpu_relax();
clear_thread_flag(TIF_POLLING_NRFLAG);
} else {
set_need_resched();
}
}
#endif /* !CONFIG_SMP || CONFIG_HOTPLUG_CPU */
/*
* the idle thread
* - there's no useful work to be done, so just try to conserve power and have
* a low exit latency (ie sit in a loop waiting for somebody to say that
* they'd like to reschedule)
*/
void cpu_idle(void)
{
/* endless idle loop with no priority at all */
for (;;) {
rcu_idle_enter();
while (!need_resched()) {
void (*idle)(void);
smp_rmb();
if (!idle) {
#if defined(CONFIG_SMP) && !defined(CONFIG_HOTPLUG_CPU)
idle = poll_idle;
#else /* CONFIG_SMP && !CONFIG_HOTPLUG_CPU */
idle = default_idle;
#endif /* CONFIG_SMP && !CONFIG_HOTPLUG_CPU */
}
idle();
}
rcu_idle_exit();
schedule_preempt_disabled();
}
} }
#endif
void release_segments(struct mm_struct *mm) void release_segments(struct mm_struct *mm)
{ {

Просмотреть файл

@ -675,7 +675,7 @@ int __init start_secondary(void *unused)
#ifdef CONFIG_GENERIC_CLOCKEVENTS #ifdef CONFIG_GENERIC_CLOCKEVENTS
init_clockevents(); init_clockevents();
#endif #endif
cpu_idle(); cpu_startup_entry(CPUHP_ONLINE);
return 0; return 0;
} }