Re: [PATCH] sched: account system time properly

From: Andrew Gallatin
Date: Wed Apr 29 2009 - 09:26:04 EST


Eric Dumazet wrote:

On mostly idle cpu, irqs were thus not accounted and top or mpstat could tell
user/admin that cpu was 100 % idle, 0.00 % irq, 0.00 % softirq, while it was not.

Reported-by: Andrew Gallatin <gallatin@xxxxxxxx>
Re-reported-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Eric Dumazet <dada1@xxxxxxxxxxxxx>
Tested-by: Eric Dumazet <dada1@xxxxxxxxxxxxx>
Acked-by: Martin Schwidefsky <schwidefsky@xxxxxxxxxx>

diff --git a/kernel/sched.c b/kernel/sched.c
index b902e58..26efa47 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -4732,7 +4732,7 @@ void account_process_tick(struct task_struct *p, int user_tick)
if (user_tick)
account_user_time(p, one_jiffy, one_jiffy_scaled);
- else if (p != rq->idle)
+ else if ((p != rq->idle) || (irq_count() != HARDIRQ_OFFSET))
account_system_time(p, HARDIRQ_OFFSET, one_jiffy,
one_jiffy_scaled);
else


I can confirm this fixes the issue for me. Thank you, and I am
sorry if my git-bisect fumble-fingers caused too much wasted time.

Cheers,

Drew
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/