mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yong Zhang <yong.zhang0@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: tglx@linutronix.de, akpm@linux-foundation.org, mingo@elte.hu,
	arjan@linux.intel.com, a.p.zijlstra@chello.nl, tj@kernel.org,
	oleg@redhat.com
Subject: [RFC PATCH 4/6] hrtimer: change call site of timer_stats_hrtimer_clear_start_info()
Date: Sun, 29 Aug 2010 23:05:07 +0800	[thread overview]
Message-ID: <1283094309-6635-5-git-send-email-yong.zhang0@gmail.com> (raw)
In-Reply-To: <1283094309-6635-1-git-send-email-yong.zhang0@gmail.com>

From: Yong Zhang <yong.zhang@windriver.com>

Put timer_stats_hrtimer_clear_start_info() to the real cancel
place.

Because remove_hrtimer() is used for internal, and it could be called
as below:
int __hrtimer_start_range_ns(ARG) {
	...
	remove_hrtimer();
	...
	timer_stats_hrtimer_set_start_info();
}

Then if remove_hrtimer() clear the start_site, the following
timer_stats_hrtimer_set_start_info() will record the caller of
__hrtimer_start_range_ns as start_site. But this is not what
we want.

Signed-off-by: Yong Zhang <yong.zhang0@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
 kernel/hrtimer.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index ce66917..2b79ab4 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -772,7 +772,7 @@ static inline void timer_stats_hrtimer_clear_start_info(struct hrtimer *timer)
 static inline void timer_stats_account_hrtimer(struct hrtimer *timer)
 {
 #ifdef CONFIG_TIMER_STATS
-	if (likely(!timer_stats_active))
+	if (!timer->start_site)
 		return;
 	timer_stats_update_stats(timer, timer->start_pid, timer->start_site,
 				 timer->function, timer->start_comm, 0);
@@ -942,7 +942,6 @@ remove_hrtimer(struct hrtimer *timer, struct hrtimer_clock_base *base)
 		 * rare case and less expensive than a smp call.
 		 */
 		debug_deactivate(timer);
-		timer_stats_hrtimer_clear_start_info(timer);
 		reprogram = base->cpu_base == &__get_cpu_var(hrtimer_bases);
 		__remove_hrtimer(timer, base, HRTIMER_STATE_INACTIVE,
 				 reprogram);
@@ -1055,9 +1054,10 @@ int hrtimer_try_to_cancel(struct hrtimer *timer)
 
 	base = lock_hrtimer_base(timer, &flags);
 
-	if (!hrtimer_callback_running(timer))
+	if (!hrtimer_callback_running(timer)){
+		timer_stats_hrtimer_clear_start_info(timer);
 		ret = remove_hrtimer(timer, base);
-
+	}
 	unlock_hrtimer_base(timer, &flags);
 
 	return ret;
-- 
1.7.0.4


  parent reply	other threads:[~2010-08-29 15:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-29 15:05 [RFC PATCHSET 0/6] timer/hrtimer/timer_stats: Improvement on timer_stats Yong Zhang
2010-08-29 15:05 ` [RFC PATCH 1/6] timer: expliciyly call timer_stats_timer_set_start_info() in add_timer() Yong Zhang
2010-08-29 15:05 ` [RFC PATCH 2/6] workqueue: remove redundant timer_stats_timer_set_start_info() Yong Zhang
2010-08-29 15:05 ` [RFC PATCH 3/6] timer: move timer_stats_timer_*_start_info() to kernel/timer.c Yong Zhang
2010-08-29 15:05 ` Yong Zhang [this message]
2010-08-29 15:05 ` [RFC PATCH 5/6] hrtimer: record more real start_site for timer_stats Yong Zhang
2010-08-29 15:05 ` [RFC PATCH 6/6] timer_stats: make output more readable Yong Zhang
2010-08-29 15:44 ` [RFC PATCHSET 0/6] timer/hrtimer/timer_stats: Improvement on timer_stats Arjan van de Ven
2010-08-30  3:27   ` Yong Zhang

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=1283094309-6635-5-git-send-email-yong.zhang0@gmail.com \
    --to=yong.zhang0@gmail.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=arjan@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=oleg@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=tj@kernel.org \
    /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®