diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2013-03-21 17:49:53 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2013-04-08 11:39:27 -0400 |
commit | af695cd931edab7f202fb616d69d4b746c5d6912 (patch) | |
tree | 604aea76a2fac326b0ebbb7dd30e90f69180fc82 /arch/mn10300/kernel | |
parent | cdbedc61c8d0122ad682815936f0d11df1fe5f57 (diff) |
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>
Diffstat (limited to 'arch/mn10300/kernel')
-rw-r--r-- | arch/mn10300/kernel/process.c | 70 | ||||
-rw-r--r-- | arch/mn10300/kernel/smp.c | 2 |
2 files changed, 7 insertions, 65 deletions
diff --git a/arch/mn10300/kernel/process.c b/arch/mn10300/kernel/process.c index 84f4e97e3074..2da39fb8b3b2 100644 --- a/arch/mn10300/kernel/process.c +++ b/arch/mn10300/kernel/process.c | |||
@@ -50,77 +50,19 @@ unsigned long thread_saved_pc(struct task_struct *tsk) | |||
50 | void (*pm_power_off)(void); | 50 | void (*pm_power_off)(void); |
51 | EXPORT_SYMBOL(pm_power_off); | 51 | EXPORT_SYMBOL(pm_power_off); |
52 | 52 | ||
53 | #if !defined(CONFIG_SMP) || defined(CONFIG_HOTPLUG_CPU) | ||
54 | /* | ||
55 | * we use this if we don't have any better idle routine | ||
56 | */ | ||
57 | static void default_idle(void) | ||
58 | { | ||
59 | local_irq_disable(); | ||
60 | if (!need_resched()) | ||
61 | safe_halt(); | ||
62 | else | ||
63 | local_irq_enable(); | ||
64 | } | ||
65 | |||
66 | #else /* !CONFIG_SMP || CONFIG_HOTPLUG_CPU */ | ||
67 | /* | 53 | /* |
68 | * On SMP it's slightly faster (but much more power-consuming!) | 54 | * On SMP it's slightly faster (but much more power-consuming!) |
69 | * to poll the ->work.need_resched flag instead of waiting for the | 55 | * to poll the ->work.need_resched flag instead of waiting for the |
70 | * cross-CPU IPI to arrive. Use this option with caution. | 56 | * cross-CPU IPI to arrive. Use this option with caution. |
57 | * | ||
58 | * tglx: No idea why this depends on HOTPLUG_CPU !?! | ||
71 | */ | 59 | */ |
72 | static inline void poll_idle(void) | 60 | #if !defined(CONFIG_SMP) || defined(CONFIG_HOTPLUG_CPU) |
73 | { | 61 | void arch_cpu_idle(void) |
74 | int oldval; | ||
75 | |||
76 | local_irq_enable(); | ||
77 | |||
78 | /* | ||
79 | * Deal with another CPU just having chosen a thread to | ||
80 | * run here: | ||
81 | */ | ||
82 | oldval = test_and_clear_thread_flag(TIF_NEED_RESCHED); | ||
83 | |||
84 | if (!oldval) { | ||
85 | set_thread_flag(TIF_POLLING_NRFLAG); | ||
86 | while (!need_resched()) | ||
87 | cpu_relax(); | ||
88 | clear_thread_flag(TIF_POLLING_NRFLAG); | ||
89 | } else { | ||
90 | set_need_resched(); | ||
91 | } | ||
92 | } | ||
93 | #endif /* !CONFIG_SMP || CONFIG_HOTPLUG_CPU */ | ||
94 | |||
95 | /* | ||
96 | * the idle thread | ||
97 | * - there's no useful work to be done, so just try to conserve power and have | ||
98 | * a low exit latency (ie sit in a loop waiting for somebody to say that | ||
99 | * they'd like to reschedule) | ||
100 | */ | ||
101 | void cpu_idle(void) | ||
102 | { | 62 | { |
103 | /* endless idle loop with no priority at all */ | 63 | safe_halt(); |
104 | for (;;) { | ||
105 | rcu_idle_enter(); | ||
106 | while (!need_resched()) { | ||
107 | void (*idle)(void); | ||
108 | |||
109 | smp_rmb(); | ||
110 | if (!idle) { | ||
111 | #if defined(CONFIG_SMP) && !defined(CONFIG_HOTPLUG_CPU) | ||
112 | idle = poll_idle; | ||
113 | #else /* CONFIG_SMP && !CONFIG_HOTPLUG_CPU */ | ||
114 | idle = default_idle; | ||
115 | #endif /* CONFIG_SMP && !CONFIG_HOTPLUG_CPU */ | ||
116 | } | ||
117 | idle(); | ||
118 | } | ||
119 | rcu_idle_exit(); | ||
120 | |||
121 | schedule_preempt_disabled(); | ||
122 | } | ||
123 | } | 64 | } |
65 | #endif | ||
124 | 66 | ||
125 | void release_segments(struct mm_struct *mm) | 67 | void release_segments(struct mm_struct *mm) |
126 | { | 68 | { |
diff --git a/arch/mn10300/kernel/smp.c b/arch/mn10300/kernel/smp.c index eaef5ad8e0ec..a17f9c9c14c9 100644 --- a/arch/mn10300/kernel/smp.c +++ b/arch/mn10300/kernel/smp.c | |||
@@ -675,7 +675,7 @@ int __init start_secondary(void *unused) | |||
675 | #ifdef CONFIG_GENERIC_CLOCKEVENTS | 675 | #ifdef CONFIG_GENERIC_CLOCKEVENTS |
676 | init_clockevents(); | 676 | init_clockevents(); |
677 | #endif | 677 | #endif |
678 | cpu_idle(); | 678 | cpu_startup_entry(CPUHP_ONLINE); |
679 | return 0; | 679 | return 0; |
680 | } | 680 | } |
681 | 681 | ||