mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] no_idle_hz (s390/xen) 2.6.16.13: fix next_timer_interrupt() when timer pending
@ 2006-06-29 10:14 Emmanuel Ackaouy
  2006-06-29 10:21 ` Arjan van de Ven
  0 siblings, 1 reply; 3+ messages in thread
From: Emmanuel Ackaouy @ 2006-06-29 10:14 UTC (permalink / raw)
  To: linux-kernel; +Cc: schwidefsky

Fix next_timer_interrupt() to return the expired timeout of any
pending timer instead of the default "nothing scheduled" timeout
value of jiffies+MAX_JIFFY_OFFSET. See comment in patch for details.

Signed-off-by: Emmanuel Ackaouy <ack@xensource.com>


diff -pruN pristine-linux-2.6.16.13/kernel/timer.c linux-2.6.16.13-xen/kernel/timer.c
--- pristine-linux-2.6.16.13/kernel/timer.c	2006-05-02 22:38:44.000000000 +0100
+++ linux-2.6.16.13-xen/kernel/timer.c	2006-06-28 21:38:58.000000000 +0100
@@ -555,7 +555,17 @@ found:
 	}
 	spin_unlock(&base->t_base.lock);
 
-	if (time_before(hr_expires, expires))
+	/*
+	 * If timers are pending, "expires" will be in the recent past
+	 * of "jiffies". If there are no hr_timers registered, "hr_expires"
+	 * will be "jiffies + MAX_JIFFY_OFFSET"; this is *just* short of being
+	 * considered to be before "jiffies". This makes it very likely that
+	 * "hr_expires" *will* be considered to be before "expires".
+	 * So we must check when there are pending timers (expires <= jiffies)
+	 * to ensure that we don't accidently tell the caller that there is
+	 * nothing scheduled until half an epoch (MAX_JIFFY_OFFSET)!
+	 */
+	if (time_before(jiffies, expires) && time_before(hr_expires, expires))
 		return hr_expires;
 
 	return expires;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] no_idle_hz (s390/xen) 2.6.16.13: fix next_timer_interrupt() when timer pending
  2006-06-29 10:14 [PATCH] no_idle_hz (s390/xen) 2.6.16.13: fix next_timer_interrupt() when timer pending Emmanuel Ackaouy
@ 2006-06-29 10:21 ` Arjan van de Ven
  2006-06-29 11:10   ` Emmanuel Ackaouy
  0 siblings, 1 reply; 3+ messages in thread
From: Arjan van de Ven @ 2006-06-29 10:21 UTC (permalink / raw)
  To: Emmanuel Ackaouy; +Cc: linux-kernel, schwidefsky

On Thu, 2006-06-29 at 11:14 +0100, Emmanuel Ackaouy wrote:
> Fix next_timer_interrupt() to return the expired timeout of any
> pending timer instead of the default "nothing scheduled" timeout
> value of jiffies+MAX_JIFFY_OFFSET. See comment in patch for details.
> 
> Signed-off-by: Emmanuel Ackaouy <ack@xensource.com>
> 
> 
> diff -pruN pristine-linux-2.6.16.13/kernel/timer.c linux-2.6.16.13-xen/kernel/timer.c
> --- pristine-linux-2.6.16.13/kernel/timer.c	2006-05-02 22:38:44.000000000 +0100
> +++ linux-2.6.16.13-xen/kernel/timer.c	2006-06-28 21:38:58.000000000 +0100

Hi,

Did you intend to push this patch for -stable or for the next version of
Linux? In general if you wanted to do the later, it's a good idea to
make a patch against the latest tree rather than a really old one....
While if you meant the former you probably want to at least CC
stable@vger.kernel.org .... 

Greetings,
   Arjan van de Ven


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] no_idle_hz (s390/xen) 2.6.16.13: fix next_timer_interrupt() when timer pending
  2006-06-29 10:21 ` Arjan van de Ven
@ 2006-06-29 11:10   ` Emmanuel Ackaouy
  0 siblings, 0 replies; 3+ messages in thread
From: Emmanuel Ackaouy @ 2006-06-29 11:10 UTC (permalink / raw)
  To: Arjan van de Ven; +Cc: Emmanuel Ackaouy, linux-kernel, schwidefsky

On Thu, Jun 29, 2006 at 12:21:22PM +0200, Arjan van de Ven wrote:
> Did you intend to push this patch for -stable or for the next version of
> Linux? In general if you wanted to do the later, it's a good idea to
> make a patch against the latest tree rather than a really old one....
> While if you meant the former you probably want to at least CC
> stable@vger.kernel.org .... 

Well that will teach me to be lazy... I assumed this code hadn't
moved but I see there's an equivalent fix already in place in
2.6.17.

Apologies for the noise.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-06-29 11:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-29 10:14 [PATCH] no_idle_hz (s390/xen) 2.6.16.13: fix next_timer_interrupt() when timer pending Emmanuel Ackaouy
2006-06-29 10:21 ` Arjan van de Ven
2006-06-29 11:10   ` Emmanuel Ackaouy

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®