public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Zachary Amsden <zach@vmware.com>
To: Keir Fraser <Keir.Fraser@cl.cam.ac.uk>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	schwidefsky@de.ibm.com
Subject: Re: [PATCH] next_timer_interrupt: simpler overflow handling
Date: Thu, 13 Jul 2006 10:02:17 -0700	[thread overview]
Message-ID: <44B67C99.8000002@vmware.com> (raw)
In-Reply-To: <722c432be3ba8eca595fb03cb78b2815@cl.cam.ac.uk>

Keir Fraser wrote:
> Having seen the patch applied to 2.6.17 to fix the overflowing 
> comparison in next_timer_interrupt() it occurred to me that a much 
> simpler fix is to not set hr_expires to MAX_JIFFY_OFFSET. It's way 
> further out from jiffies than necessary, which is why it's caused 
> problems. I instead propose that we initialise it to LONG_MAX>>1, just 
> as we already do for the non-hr expires variable. This will allow safe 
> comparison with any timer value in the range jiffies+/-(LONG_MAX>>1) 
> which is plenty of range around jiffies (+/- 12 days if HZ=1000 and 
> long is 32 bits).
>
> The advantages are simpler code, and uniform initialisation of expires 
> and hr_expires variables.

Even simpler would be to just make MAX_JIFFY_OFFSET be (LONG_MAX >> 1) 
and use this for both.  In fact, it appears it used to be, judging by 
the comment in jiffies.h:

 * The maximum jiffie value is (MAX_INT >> 1).  Here we translate that

But seeing as this could have unanticipated side effects, I like this 
fix better.

Acked-By: Zachary Amsden <zach@vmware.com>

      reply	other threads:[~2006-07-13 17:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-13  8:54 [PATCH] next_timer_interrupt: simpler overflow handling Keir Fraser
2006-07-13 17:02 ` Zachary Amsden [this message]

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=44B67C99.8000002@vmware.com \
    --to=zach@vmware.com \
    --cc=Keir.Fraser@cl.cam.ac.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=schwidefsky@de.ibm.com \
    /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