[patch] high-res timers: next_event calculation fix

From: Ingo Molnar
Date: Sat Dec 09 2006 - 06:38:01 EST


Subject: [patch] high-res timers: next_event calculation fix
From: Ingo Molnar <mingo@xxxxxxx>

do not set expires_next to KTIME_MAX if a too short timeout
is being set - this can result in the clock events device
being shut down completely.

found via a stresstest on a C3-lapic-plagued laptop that did
very short sleeps.

This bug could explain the 'Synaptics hang' that was reported.

Signed-off-by: Ingo Molnar <mingo@xxxxxxx>
Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
---
kernel/time/clockevents.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

Index: linux/kernel/time/clockevents.c
===================================================================
--- linux.orig/kernel/time/clockevents.c
+++ linux/kernel/time/clockevents.c
@@ -510,10 +510,8 @@ int clockevents_set_next_event(ktime_t e
struct clock_event_device *nextevt = devices->nextevt;
int64_t delta = ktime_to_ns(ktime_sub(expires, ktime_get()));

- if (delta <= 0 && !force) {
- devices->expires_next.tv64 = KTIME_MAX;
+ if (delta <= 0 && !force)
return -ETIME;
- }

devices->expires_next = expires;

-
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/