diff options
author | Namhyung Kim <namhyung.kim@lge.com> | 2012-12-26 21:49:44 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2013-02-19 02:42:40 -0500 |
commit | c06b4f1947213cd0902610fafcabac02d49ad728 (patch) | |
tree | 8b83c64b2682c46db32f7987cd8d2795a6bf7397 /kernel/watchdog.c | |
parent | f86f75548233a2be7379ac446e91729710d4a5f7 (diff) |
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>
Diffstat (limited to 'kernel/watchdog.c')
-rw-r--r-- | kernel/watchdog.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/kernel/watchdog.c b/kernel/watchdog.c index 75a2ab3d0b02..082ca6878a3f 100644 --- a/kernel/watchdog.c +++ b/kernel/watchdog.c | |||
@@ -112,9 +112,9 @@ static int get_softlockup_thresh(void) | |||
112 | * resolution, and we don't need to waste time with a big divide when | 112 | * resolution, and we don't need to waste time with a big divide when |
113 | * 2^30ns == 1.074s. | 113 | * 2^30ns == 1.074s. |
114 | */ | 114 | */ |
115 | static unsigned long get_timestamp(int this_cpu) | 115 | static unsigned long get_timestamp(void) |
116 | { | 116 | { |
117 | return cpu_clock(this_cpu) >> 30LL; /* 2^30 ~= 10^9 */ | 117 | return local_clock() >> 30LL; /* 2^30 ~= 10^9 */ |
118 | } | 118 | } |
119 | 119 | ||
120 | static void set_sample_period(void) | 120 | static void set_sample_period(void) |
@@ -132,9 +132,7 @@ static void set_sample_period(void) | |||
132 | /* Commands for resetting the watchdog */ | 132 | /* Commands for resetting the watchdog */ |
133 | static void __touch_watchdog(void) | 133 | static void __touch_watchdog(void) |
134 | { | 134 | { |
135 | int this_cpu = smp_processor_id(); | 135 | __this_cpu_write(watchdog_touch_ts, get_timestamp()); |
136 | |||
137 | __this_cpu_write(watchdog_touch_ts, get_timestamp(this_cpu)); | ||
138 | } | 136 | } |
139 | 137 | ||
140 | void touch_softlockup_watchdog(void) | 138 | void touch_softlockup_watchdog(void) |
@@ -195,7 +193,7 @@ static int is_hardlockup(void) | |||
195 | 193 | ||
196 | static int is_softlockup(unsigned long touch_ts) | 194 | static int is_softlockup(unsigned long touch_ts) |
197 | { | 195 | { |
198 | unsigned long now = get_timestamp(smp_processor_id()); | 196 | unsigned long now = get_timestamp(); |
199 | 197 | ||
200 | /* Warn about unreasonable delays: */ | 198 | /* Warn about unreasonable delays: */ |
201 | if (time_after(now, touch_ts + get_softlockup_thresh())) | 199 | if (time_after(now, touch_ts + get_softlockup_thresh())) |