From: Bodo Eggert <harvested.in.lkml@7eggert.dyndns.org>
To: jeff shia <tshxiayu@gmail.com>,
linux-kernel@vger.kernel.org, robert love <rml@novell.com>
Subject: Re: something about jiffies wraparound overflow
Date: Tue, 27 Dec 2005 11:06:05 +0100 [thread overview]
Message-ID: <E1ErBiY-0000c6-Ic@be1.lrz> (raw)
In-Reply-To: 5oeWK-5Od-11@gated-at.bofh.it
jeff shia <tshxiayu@gmail.com> wrote:
> we use the following to solve the problem of jiffies wraparound.
> #define time_after(a,b) \
> (typecheck(unsigned long, a) && \
> typecheck(unsigned long, b) && \
> ((long)(b) - (long)(a) < 0))
> #define time_before(a,b) time_after(b,a)
[...]
> But I cannot understand it has some differences comparing with the
> following code.
>
> /* code 2*/
>
> unsigned long timeout = jiffies + HZ/2;
>
> if(timeout < jiffies)
> questions:
> 1.why the macros of time_after can solve the jiffies wraparound problem?
Because the overflows get compensated. It's a property of Galois Fields.
> 2.Is there any other possibilities for the "code 2" to overflow
> except the jiffies overflow?
timeout might overflow, too.
--
Ich danke GMX dafür, die Verwendung meiner Adressen mittels per SPF
verbreiteten Lügen zu sabotieren.
next parent reply other threads:[~2005-12-27 10:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <5oeWK-5Od-11@gated-at.bofh.it>
2005-12-27 10:06 ` Bodo Eggert [this message]
2005-12-27 4:46 something about jiffies wraparound overflow jeff shia
2005-12-27 8:54 ` lk
2005-12-27 9:05 ` Con Kolivas
2005-12-27 14:54 ` Ben Collins
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=E1ErBiY-0000c6-Ic@be1.lrz \
--to=harvested.in.lkml@7eggert.dyndns.org \
--cc=7eggert@gmx.de \
--cc=linux-kernel@vger.kernel.org \
--cc=rml@novell.com \
--cc=tshxiayu@gmail.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