Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932439Ab0LNWsz (ORCPT ); Tue, 14 Dec 2010 17:48:55 -0500 Received: from mailout-de.gmx.net ([213.165.64.23]:42901 "HELO mail.gmx.net" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with SMTP id S932211Ab0LNWsy (ORCPT ); Tue, 14 Dec 2010 17:48:54 -0500 X-Authenticated: #41721828 X-Provags-ID: V01U2FsdGVkX1+XfW5AjtqXwZKM2Apuva2wimCl49571gKoe882EE ZFtzj+uVS77Lni Date: Tue, 14 Dec 2010 23:48:48 +0100 From: Jonathan =?utf-8?Q?Neusch=C3=A4fer?= To: linux-kernel@vger.kernel.org Cc: Russell King , Nicolas Pitre , Catalin Marinas , Will Deacon , Kevin Hilman , Tony Lindgren , Jeremy Kerr , Eric Miao , linux-arm-kernel@lists.infradead.org Subject: [PATCH] arch/arm/kernel: use cpu_relax() in halt loops Message-ID: <20101214224848.GA1706@debian.debian> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.5.20 (2009-06-14) X-Y-GMX-Trusted: 0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2013 Lines: 73 Looking throught arch/arm/kernel/ I found some halt loops. I just thought we could save some power here using cpu_relax(), or am I missing something? Signed-off-by: Jonathan Neuschäfer --- arch/arm/kernel/process.c | 6 ++++-- arch/arm/kernel/setup.c | 7 +++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c index e76fcaa..4a83fdf 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c @@ -124,7 +124,8 @@ void arm_machine_restart(char mode, const char *cmd) */ mdelay(1000); printk("Reboot failed -- System halted\n"); - while (1); + while (1) + cpu_relax(); } /* @@ -235,7 +236,8 @@ void machine_shutdown(void) void machine_halt(void) { machine_shutdown(); - while (1); + while (1) + cpu_relax(); } void machine_power_off(void) diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index 336f14e..0d77329 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c @@ -41,6 +41,7 @@ #include #include #include +#include #include #include @@ -337,7 +338,8 @@ static void __init setup_processor(void) if (!list) { printk("CPU configuration botched (ID %08x), unable " "to continue.\n", read_cpuid_id()); - while (1); + while (1) + cpu_relax(); } cpu_name = list->cpu_name; @@ -434,7 +436,8 @@ static struct machine_desc * __init setup_machine(unsigned int nr) if (!list) { printk("Machine configuration botched (nr %d), unable " "to continue.\n", nr); - while (1); + while (1) + cpu_relax(); } printk("Machine: %s\n", list->name); -- 1.7.2.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/