From c83e44842074a87614c78eca70fa6467b0bc3c4a Mon Sep 17 00:00:00 2001
From: Jeff Dike <jdike@addtoit.com>
Date: Tue, 8 May 2007 00:23:22 -0700
Subject: [PATCH] uml: an idle system should have zero load average

The ever-vigilant users of linode.com noticed that an idle 2.6 UML has a
persistent load average of ~.4.

It turns out that because the UML timer handler processed softirqs before
actually delivering the tick, the tick was counted in the context of the idle
thread about half the time.

Signed-off-by: Jeff Dike <jdike@linux.intel.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---
 arch/um/kernel/time.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/um/kernel/time.c b/arch/um/kernel/time.c
index cd7349de8ca..259c49da7ff 100644
--- a/arch/um/kernel/time.c
+++ b/arch/um/kernel/time.c
@@ -177,6 +177,8 @@ int do_settimeofday(struct timespec *tv)
 
 void timer_handler(int sig, union uml_pt_regs *regs)
 {
+	if(current_thread->cpu == 0)
+		timer_irq(regs);
 	local_irq_disable();
 	irq_enter();
 	update_process_times(CHOOSE_MODE(
@@ -184,6 +186,4 @@ void timer_handler(int sig, union uml_pt_regs *regs)
 			     (regs)->skas.is_user));
 	irq_exit();
 	local_irq_enable();
-	if(current_thread->cpu == 0)
-		timer_irq(regs);
 }
-- 
2.20.1