From: tip-bot for Namhyung Kim <namhyung.kim@lge.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@kernel.org,
namhyung.kim@lge.com, namhyung@kernel.org, rostedt@goodmis.org,
tglx@linutronix.de, dzickus@redhat.com
Subject: [tip:core/locking] watchdog: Use local_clock for get_timestamp()
Date: Thu, 24 Jan 2013 12:20:21 -0800 [thread overview]
Message-ID: <tip-03d8c5dc53d2e883bd3badb6436a33fc64e2f638@git.kernel.org> (raw)
In-Reply-To: <1356576585-28782-1-git-send-email-namhyung@kernel.org>
Commit-ID: 03d8c5dc53d2e883bd3badb6436a33fc64e2f638
Gitweb: http://git.kernel.org/tip/03d8c5dc53d2e883bd3badb6436a33fc64e2f638
Author: Namhyung Kim <namhyung.kim@lge.com>
AuthorDate: Thu, 27 Dec 2012 11:49:44 +0900
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Thu, 24 Jan 2013 15:13:36 +0100
watchdog: Use local_clock for get_timestamp()
The get_timestamp() function is always called with current cpu,
thus using local_clock() would be more appropriate and it makes
the code shorter and cleaner IMHO.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Don Zickus <dzickus@redhat.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1356576585-28782-1-git-send-email-namhyung@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
kernel/watchdog.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index 75a2ab3..082ca68 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -112,9 +112,9 @@ static int get_softlockup_thresh(void)
* resolution, and we don't need to waste time with a big divide when
* 2^30ns == 1.074s.
*/
-static unsigned long get_timestamp(int this_cpu)
+static unsigned long get_timestamp(void)
{
- return cpu_clock(this_cpu) >> 30LL; /* 2^30 ~= 10^9 */
+ return local_clock() >> 30LL; /* 2^30 ~= 10^9 */
}
static void set_sample_period(void)
@@ -132,9 +132,7 @@ static void set_sample_period(void)
/* Commands for resetting the watchdog */
static void __touch_watchdog(void)
{
- int this_cpu = smp_processor_id();
-
- __this_cpu_write(watchdog_touch_ts, get_timestamp(this_cpu));
+ __this_cpu_write(watchdog_touch_ts, get_timestamp());
}
void touch_softlockup_watchdog(void)
@@ -195,7 +193,7 @@ static int is_hardlockup(void)
static int is_softlockup(unsigned long touch_ts)
{
- unsigned long now = get_timestamp(smp_processor_id());
+ unsigned long now = get_timestamp();
/* Warn about unreasonable delays: */
if (time_after(now, touch_ts + get_softlockup_thresh()))
next prev parent reply other threads:[~2013-01-24 20:20 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-27 2:49 [PATCH 1/2] watchdog: Use local_clock for get_timestamp() Namhyung Kim
2012-12-27 2:49 ` [PATCH 2/2] tracing: Use sched_clock_cpu for trace_clock_global Namhyung Kim
2012-12-27 9:52 ` Namhyung Kim
2013-01-07 13:54 ` Steven Rostedt
2013-02-03 19:22 ` [tip:perf/core] " tip-bot for Namhyung Kim
2013-01-02 20:09 ` [PATCH 1/2] watchdog: Use local_clock for get_timestamp() Don Zickus
2013-01-24 20:20 ` tip-bot for Namhyung Kim [this message]
2013-02-22 12:23 ` [tip:core/locking] " tip-bot for Namhyung Kim
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=tip-03d8c5dc53d2e883bd3badb6436a33fc64e2f638@git.kernel.org \
--to=namhyung.kim@lge.com \
--cc=dzickus@redhat.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=rostedt@goodmis.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