2001-04-13 23:22:45

by Thiago Rondon

[permalink] [raw]
Subject: [QUESTION] init/main.c


At function calibrate_delay(void) in init/main.c,
I dont understand this code:

<<EOF
/* wait for "start of" clock tick */
ticks = jiffies;
while (ticks == jiffies)
/* nothing */;
/* Go .. */

ticks = jiffies;
EOF

ticks = jiffies; while (ticks == jiffies); ticks = jiffies; ?

Thanks in advanced,
-Thiago Rondon


2001-04-13 23:42:10

by Bart Trojanowski

[permalink] [raw]
Subject: Re: [QUESTION] init/main.c


jiffies is updated by a timer interrupt once every 1/HZ seconds (HZ==100
for i386).

The code intents to start running at the time right after jiffies was
incremented to improve the correctness of the delay calibration loop.

The reason why jiffies is read later is to get the value after the
change... if the interrupts are sporadic then the increment could be 2 ...
although not very likely.

Bart.

On Fri, 13 Apr 2001, Thiago Rondon wrote:

>
> At function calibrate_delay(void) in init/main.c,
> I dont understand this code:
>
> <<EOF
> /* wait for "start of" clock tick */
> ticks = jiffies;
> while (ticks == jiffies)
> /* nothing */;
> /* Go .. */
>
> ticks = jiffies;
> EOF
>
> ticks = jiffies; while (ticks == jiffies); ticks = jiffies; ?
>
> Thanks in advanced,
> -Thiago Rondon
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>

--
WebSig: http://www.jukie.net/~bart/sig/

2001-04-14 06:03:34

by Jonathan Morton

[permalink] [raw]
Subject: Re: [QUESTION] init/main.c

>ticks = jiffies; while (ticks == jiffies); ticks = jiffies; ?

jiffies is updated by an interrupt routine, I think.

--------------------------------------------------------------
from: Jonathan "Chromatix" Morton
mail: [email protected] (not for attachments)
big-mail: [email protected]
uni-mail: [email protected]

The key to knowledge is not to rely on people to teach you it.

Get VNC Server for Macintosh from http://www.chromatix.uklinux.net/vnc/

-----BEGIN GEEK CODE BLOCK-----
Version 3.12
GCS$/E/S dpu(!) s:- a20 C+++ UL++ P L+++ E W+ N- o? K? w--- O-- M++$ V? PS
PE- Y+ PGP++ t- 5- X- R !tv b++ DI+++ D G e+ h+ r++ y+(*)
-----END GEEK CODE BLOCK-----