Re: Negative values in /proc/latency_stats

From: Andrew Morton
Date: Mon Feb 02 2009 - 23:56:39 EST


On Sat, 31 Jan 2009 14:42:20 +0100 Corrado Zoccolo <czoccolo@xxxxxxxxx> wrote:

> Hello,
> I found negative numbers sometimes appear in /proc/latency_stats
> (vanilla kernel 2.6.29-rc3, on x86 cpu, configuration attached)
>
> [corrado@localhost ~]$ while sleep 1; do grep -- - /proc/latency_stats
> >> neg_stats; done
> ^Z
> [1]+ Stopped sleep 1
> [corrado@localhost ~]$ cat neg_stats
> 1 -486373534 -486373534 sys_rt_sigsuspend sysenter_do_call
> 1 -486373534 -486373534 sys_rt_sigsuspend sysenter_do_call
> 1 -486373534 -486373534 sys_rt_sigsuspend sysenter_do_call
>
>
> I suspect this can be the cause for
> https://bugs.launchpad.net/ubuntu/+source/latencytop/+bug/297776 , as
> I saw it happening on my machine during a kernel recompilation.
>

<discovers kernel/latencytop.c>

- It implements a kernel/userspace interface yet it has zero documentation.

- It was committed with a 2-line changelog which tells us practically
nothing.

- It implements an up-to-1536-loops loop followed by an
up-to-384-loops loop on a scheduler hotpath.

All under spin_lock_irqsave()!

- store_stacktrace() unnecessarily initalises trace.skip.

- account_scheduler_latency() should be an inline:

if (unlikely(latencytop_enabled))
__account_scheduler_latency(...);

- ditto clear_all_latency_tracing()

- it's schizophrenic in its placement of spaces around semicolons in
`for' statements.

- it seems to only be implemented if CONFIG_FAIR_GROUP_SCHED=y.

- lstats_fops should be const.


And it emits negative numbers too ;)
--
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/