Re: [patch 0/2] NOHZ vs. profile/oprofile v2

Ingo Molnar
2009-06-22T14:41:28Z

* Martin Schwidefsky <schwidefsky@de.ibm.com> wrote:

> On Tue, 9 Jun 2009 22:52:51 +0200 (CEST)
> Thomas Gleixner <tglx@linutronix.de> wrote:
>
> > > version 2 of the profile patches. The only change is the in_interrupt()
> > > fix in tick_nohz_stop_idle(). I would like to know how to proceed with
> > > the issue.
> > > Andy, do you still prefer to handle the old style profiler analog to
> > > the oprofile patch? If yes I would drop patch #1 and extend patch #2
> > > with another tick_nohz_disable().
> >
> > Any update on this one ?
>
> A solution to this problem should go upstream soon, no? How about this
> patch, it uses the tick_nohz_disable/tick_nohz_enable mechanic for
> oprofile and the old style kernel profiler. Good enough ?
>
> ---
> Subject: [PATCH] keep on ticking if a profiler is active
>
> From: Martin Schwidefsky <schwidefsky@de.ibm.com>
>
> On a NOHZ system with oprofile or the old style kernel profiler enabled
> the timer tick should not be stopped when a cpu goes idle. Currently
> a maximum of 1 tick is accounted if a cpu sleeps for a longer period of
> time. This does bad things to the percentages in the profiler output.
>
> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
> ---
>
> drivers/oprofile/oprof.c | 3 +++
> include/linux/tick.h | 4 ++++
> kernel/profile.c | 4 ++++
> kernel/time/tick-sched.c | 27 ++++++++++++++++++++++++++-
> 4 files changed, 37 insertions(+), 1 deletion(-)

Hm, this is rather ugly. Why not use hrtimers like 'perf' does when
it fallback-samples based on the timer tick?

That method has three advantages:

- no weird hookery needed
- resolution can go far beyond HZ
- it is evidently dynticks-safe

Ingo