[PATCH 2/3] softlockup: sanitize print-out limit checks

From: Johannes Weiner
Date: Thu Jun 26 2008 - 20:16:04 EST


The print_timestamp can never be bigger than the touch_timestamp, at
maximum it can be equal. And if it is, the second check for
touch_timestamp + 1 bigger print_timestamp is always true, too.

The check for equality is sufficient as we proceed in one-second-steps
and are at least one second away from the last print-out if we have
another timestamp.

Signed-off-by: Johannes Weiner <hannes@xxxxxxxxxxxx>
---
kernel/softlockup.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

--- a/kernel/softlockup.c
+++ b/kernel/softlockup.c
@@ -93,11 +93,11 @@ void softlockup_tick(void)
print_timestamp = per_cpu(print_timestamp, this_cpu);

/* report at most once a second */
- if ((print_timestamp >= touch_timestamp &&
- print_timestamp < (touch_timestamp + 1)) ||
- did_panic || !per_cpu(watchdog_task, this_cpu)) {
+ if (print_timestamp == touch_timestamp)
+ return;
+
+ if (did_panic || !per_cpu(watchdog_task, this_cpu))
return;
- }

/* do not print during early bootup: */
if (unlikely(system_state != SYSTEM_RUNNING)) {

--

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/