Messages in this thread Patch in this message | | | From | "Khimenko Victor" <> | Date | Sun, 20 Feb 2000 19:21:55 +0300 (MSK) | Subject | Re: patch: delay_50ms() in ide-probe.c in 2.2.14 |
| |
In <Pine.LNX.4.10.10002200721010.9714-100000@lap.arijort.home> arijort@valinux.com (arijort@valinux.com) wrote:
> Simple arithmetic tells me this patch
> a) produces same behavior as previous code, and
Are you sure ??? Jiffes is *VOLATILE* variable. And it's REALLY volatile.
> b) does it with fewer calculations.
Yes, this version does DIFFERENT thing thenoriginal one. But faster :-)
> So it has to be good, right?
No.
> But then how do we exit the while loop?
In you version it'll not happen.
> How does jiffies change?
In timer interrupt.
> This patch applies cleanly against 2.2.14 > Against 2.3.45, the relevant file is ide.c > but otherwise, it's clean.
And it's wrong in 2.2.14 and 2.3.45 :-)
> --- drivers/block/ide-probe.c.orig Sun Feb 20 00:46:54 2000 > +++ drivers/block/ide-probe.c Sun Feb 20 07:28:32 2000 > @@ -154,8 +154,7 @@ > */ > static void delay_50ms (void) > { > - unsigned long timeout = jiffies + ((HZ + 19)/20) + 1; > - while (0 < (signed long)(timeout - jiffies)); > + while (0 < (signed long)((HZ + 39)/20)); > }
> /*
P.S. "Simple arithmetic" can be VERY wrong in multithreaded program. Like linux kernel.
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |