Skip to content

Commit 0dc8153

Browse files
committed
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>
1 parent e26ef8f commit 0dc8153

File tree

3 files changed

+11
-57
lines changed

3 files changed

+11
-57
lines changed

arch/tile/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ config TILE
2222
select ARCH_HAVE_NMI_SAFE_CMPXCHG
2323
select GENERIC_CLOCKEVENTS
2424
select MODULES_USE_ELF_RELA
25+
select GENERIC_IDLE_LOOP
2526

2627
# FIXME: investigate whether we need/want these options.
2728
# select HAVE_IOREMAP_PROT

arch/tile/kernel/process.c

Lines changed: 9 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -40,78 +40,31 @@
4040
#include <arch/abi.h>
4141
#include <arch/sim_def.h>
4242

43-
4443
/*
4544
* Use the (x86) "idle=poll" option to prefer low latency when leaving the
4645
* idle loop over low power while in the idle loop, e.g. if we have
4746
* one thread per core and we want to get threads out of futex waits fast.
4847
*/
49-
static int no_idle_nap;
5048
static int __init idle_setup(char *str)
5149
{
5250
if (!str)
5351
return -EINVAL;
5452

5553
if (!strcmp(str, "poll")) {
5654
pr_info("using polling idle threads.\n");
57-
no_idle_nap = 1;
58-
} else if (!strcmp(str, "halt"))
59-
no_idle_nap = 0;
60-
else
61-
return -1;
62-
63-
return 0;
55+
cpu_idle_poll_ctrl(true);
56+
return 0;
57+
} else if (!strcmp(str, "halt")) {
58+
return 0;
59+
}
60+
return -1;
6461
}
6562
early_param("idle", idle_setup);
6663

67-
/*
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)
64+
void arch_cpu_idle(void)
7465
{
75-
int cpu = smp_processor_id();
76-
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-
}
66+
__get_cpu_var(irq_stat).idle_timestamp = jiffies;
67+
_cpu_idle();
11568
}
11669

11770
/*

arch/tile/kernel/smpboot.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ void __cpuinit online_secondary(void)
207207
/* Set up tile-timer clock-event device on this cpu */
208208
setup_tile_timer();
209209

210-
cpu_idle();
210+
cpu_startup_entry(CPUHP_ONLINE);
211211
}
212212

213213
int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle)

0 commit comments

Comments
 (0)