diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2013-03-21 17:50:01 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2013-04-08 11:39:28 -0400 |
commit | 0dc8153cfebac68c9523b8852b14f10b31209f08 (patch) | |
tree | bed487eb3e6f5058f7a33bc33f6a75e8f9873961 /arch/tile | |
parent | e26ef8fe722d5c1c0c1a0212542da8fc2b21a89f (diff) |
tile: Use generic idle loop
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>
Acked-by: Chris Metcalf <cmetcalf@tilera.com>
Link: http://lkml.kernel.org/r/20130321215235.348460344@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/tile')
-rw-r--r-- | arch/tile/Kconfig | 1 | ||||
-rw-r--r-- | arch/tile/kernel/process.c | 65 | ||||
-rw-r--r-- | arch/tile/kernel/smpboot.c | 2 |
3 files changed, 11 insertions, 57 deletions
diff --git a/arch/tile/Kconfig b/arch/tile/Kconfig index 25877aebc685..85b2edeade31 100644 --- a/arch/tile/Kconfig +++ b/arch/tile/Kconfig | |||
@@ -22,6 +22,7 @@ config TILE | |||
22 | select ARCH_HAVE_NMI_SAFE_CMPXCHG | 22 | select ARCH_HAVE_NMI_SAFE_CMPXCHG |
23 | select GENERIC_CLOCKEVENTS | 23 | select GENERIC_CLOCKEVENTS |
24 | select MODULES_USE_ELF_RELA | 24 | select MODULES_USE_ELF_RELA |
25 | select GENERIC_IDLE_LOOP | ||
25 | 26 | ||
26 | # FIXME: investigate whether we need/want these options. | 27 | # FIXME: investigate whether we need/want these options. |
27 | # select HAVE_IOREMAP_PROT | 28 | # select HAVE_IOREMAP_PROT |
diff --git a/arch/tile/kernel/process.c b/arch/tile/kernel/process.c index caf93ae11793..80b2a18deb87 100644 --- a/arch/tile/kernel/process.c +++ b/arch/tile/kernel/process.c | |||
@@ -40,13 +40,11 @@ | |||
40 | #include <arch/abi.h> | 40 | #include <arch/abi.h> |
41 | #include <arch/sim_def.h> | 41 | #include <arch/sim_def.h> |
42 | 42 | ||
43 | |||
44 | /* | 43 | /* |
45 | * Use the (x86) "idle=poll" option to prefer low latency when leaving the | 44 | * Use the (x86) "idle=poll" option to prefer low latency when leaving the |
46 | * idle loop over low power while in the idle loop, e.g. if we have | 45 | * idle loop over low power while in the idle loop, e.g. if we have |
47 | * one thread per core and we want to get threads out of futex waits fast. | 46 | * one thread per core and we want to get threads out of futex waits fast. |
48 | */ | 47 | */ |
49 | static int no_idle_nap; | ||
50 | static int __init idle_setup(char *str) | 48 | static int __init idle_setup(char *str) |
51 | { | 49 | { |
52 | if (!str) | 50 | if (!str) |
@@ -54,64 +52,19 @@ static int __init idle_setup(char *str) | |||
54 | 52 | ||
55 | if (!strcmp(str, "poll")) { | 53 | if (!strcmp(str, "poll")) { |
56 | pr_info("using polling idle threads.\n"); | 54 | pr_info("using polling idle threads.\n"); |
57 | no_idle_nap = 1; | 55 | cpu_idle_poll_ctrl(true); |
58 | } else if (!strcmp(str, "halt")) | 56 | return 0; |
59 | no_idle_nap = 0; | 57 | } else if (!strcmp(str, "halt")) { |
60 | else | 58 | return 0; |
61 | return -1; | 59 | } |
62 | 60 | return -1; | |
63 | return 0; | ||
64 | } | 61 | } |
65 | early_param("idle", idle_setup); | 62 | early_param("idle", idle_setup); |
66 | 63 | ||
67 | /* | 64 | void arch_cpu_idle(void) |
68 | * The idle thread. There's no useful work to be | ||
69 | * done, so just try to conserve power and have a | ||
70 | * low exit latency (ie sit in a loop waiting for | ||
71 | * somebody to say that they'd like to reschedule) | ||
72 | */ | ||
73 | void cpu_idle(void) | ||
74 | { | 65 | { |
75 | int cpu = smp_processor_id(); | 66 | __get_cpu_var(irq_stat).idle_timestamp = jiffies; |
76 | 67 | _cpu_idle(); | |
77 | |||
78 | current_thread_info()->status |= TS_POLLING; | ||
79 | |||
80 | if (no_idle_nap) { | ||
81 | while (1) { | ||
82 | while (!need_resched()) | ||
83 | cpu_relax(); | ||
84 | schedule(); | ||
85 | } | ||
86 | } | ||
87 | |||
88 | /* endless idle loop with no priority at all */ | ||
89 | while (1) { | ||
90 | tick_nohz_idle_enter(); | ||
91 | rcu_idle_enter(); | ||
92 | while (!need_resched()) { | ||
93 | if (cpu_is_offline(cpu)) | ||
94 | BUG(); /* no HOTPLUG_CPU */ | ||
95 | |||
96 | local_irq_disable(); | ||
97 | __get_cpu_var(irq_stat).idle_timestamp = jiffies; | ||
98 | current_thread_info()->status &= ~TS_POLLING; | ||
99 | /* | ||
100 | * TS_POLLING-cleared state must be visible before we | ||
101 | * test NEED_RESCHED: | ||
102 | */ | ||
103 | smp_mb(); | ||
104 | |||
105 | if (!need_resched()) | ||
106 | _cpu_idle(); | ||
107 | else | ||
108 | local_irq_enable(); | ||
109 | current_thread_info()->status |= TS_POLLING; | ||
110 | } | ||
111 | rcu_idle_exit(); | ||
112 | tick_nohz_idle_exit(); | ||
113 | schedule_preempt_disabled(); | ||
114 | } | ||
115 | } | 68 | } |
116 | 69 | ||
117 | /* | 70 | /* |
diff --git a/arch/tile/kernel/smpboot.c b/arch/tile/kernel/smpboot.c index 11c0190bb096..44bab29bf2f3 100644 --- a/arch/tile/kernel/smpboot.c +++ b/arch/tile/kernel/smpboot.c | |||
@@ -207,7 +207,7 @@ void __cpuinit online_secondary(void) | |||
207 | /* Set up tile-timer clock-event device on this cpu */ | 207 | /* Set up tile-timer clock-event device on this cpu */ |
208 | setup_tile_timer(); | 208 | setup_tile_timer(); |
209 | 209 | ||
210 | cpu_idle(); | 210 | cpu_startup_entry(CPUHP_ONLINE); |
211 | } | 211 | } |
212 | 212 | ||
213 | int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle) | 213 | int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle) |