Commit f5f293a4 authored by Eric Dumazet's avatar Eric Dumazet Committed by Ingo Molnar

sched: account system time properly

Andrew Gallatin reported that IRQ and SOFTIRQ times were
sometime not reported correctly on recent kernels, and even
bisected to commit 457533a7
([PATCH] fix scaled & unscaled cputime accounting) as the first
bad commit.

Further analysis pointed that commit
79741dd3 ([PATCH] idle cputime
accounting) was the real cause of the problem.

account_process_tick() was not taking into account timer IRQ
interrupting the idle task servicing a hard or soft irq.

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.

[ Impact: fix occasionally incorrect CPU statistics in top/mpstat ]
Reported-by: default avatarAndrew Gallatin <gallatin@myri.com>
Re-reported-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarEric Dumazet <dada1@cosmosbay.com>
Acked-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
Cc: rick.jones2@hp.com
Cc: brice@myri.com
Cc: Paul Mackerras <paulus@samba.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
LKML-Reference: <49F84BC1.7080602@cosmosbay.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 56a50add
...@@ -4732,7 +4732,7 @@ void account_process_tick(struct task_struct *p, int user_tick) ...@@ -4732,7 +4732,7 @@ void account_process_tick(struct task_struct *p, int user_tick)
if (user_tick) if (user_tick)
account_user_time(p, one_jiffy, one_jiffy_scaled); 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, account_system_time(p, HARDIRQ_OFFSET, one_jiffy,
one_jiffy_scaled); one_jiffy_scaled);
else else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment