mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Feng Tang <feng.tang@intel.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Arjan van de Ven <arjan@infradead.org>
Subject: Re: [PATCH] hrtimers: Remove the "timer_stats_active" check when setting the start info
Date: Tue, 15 Sep 2009 17:17:00 +0800	[thread overview]
Message-ID: <20090915171700.5669bb59@feng-desktop> (raw)
In-Reply-To: <alpine.LFD.2.00.0909151056160.8957@localhost.localdomain>

On Tue, 15 Sep 2009 17:00:09 +0800
Thomas Gleixner <tglx@linutronix.de> wrote:

> > 
> > Recent hrtimer code will set the start info to a hrtimer only when
> > that flag is set, then the start info of all hrtimers will always
> > be uninitialised before a "echo 1 > /proc/timer_stats", thus
> > the /proc/timer_lists will have something like:
> > 
> > active timers:
> >  #0: <c27d46b0>, tick_sched_timer, S:01, <(null)>, /-1
> >  # expires at 91062000000-91062000000 nsecs [in 156071 to 156071
> > nsecs] #1: <efb81b6c>, hrtimer_wakeup, S:01, <(null)>, /-1
> >  # expires at 91062300331-91062350331 nsecs [in 456402 to 506402
> > nsecs] #2: <efac9b6c>, hrtimer_wakeup, S:01, <(null)>, /-1
> >  # expires at 91068699811-91068749811 nsecs [in 6855882 to 6905882
> > nsecs] #3: <efacdb6c>, hrtimer_wakeup, S:01, <(null)>, /-1
> >  # expires at 91068755511-91068805511 nsecs [in 6911582 to 6961582
> > nsecs] #4: <efa95b6c>, hrtimer_wakeup, S:01, <(null)>, /-1
> >  # expires at 91068806066-91068856066 nsecs [in 6962137 to 7012137
> > nsecs] .....
> > 
> > This patch will fix it.
> 
> Well, at the same time it forces the memcpy when !timer_stats_active.
> We generally want to avoid such overhead when debug facilities are
> disabled.

I understand the performance point, that's why I add a check line trying
to avoid unnecessary copy (yes, the check itself will bring some overload):
 
 void __timer_stats_hrtimer_set_start_info(struct hrtimer *timer, void *addr)
 {
-       if (timer->start_site)
+       if (timer->start_site == addr && timer->start_pid == current->pid)
                return;

Also there is one corner case, that a hrtimer get initialized and queued in
before setting timer_stats_active to 1, but get run after that. Then its
start_site will be NULL which will prevent it from being accounted. 

Thanks,
Feng



      reply	other threads:[~2009-09-15  9:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-03  8:32 Feng Tang
2009-09-15  9:00 ` Thomas Gleixner
2009-09-15  9:17   ` Feng Tang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090915171700.5669bb59@feng-desktop \
    --to=feng.tang@intel.com \
    --cc=arjan@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®