question about init/calibrate.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I am not clear with the logic of init/calibrate.c
http://lxr.ncu.cc/source/init/calibrate.c
from line 45 it mentions the following comment.
/*
045          * A simple loop like
046          *      while ( jiffies < start_jiffies+1)
047          *              start = read_current_timer();
048          * will not do. As we don't really know whether jiffy switch
049          * happened first or timer_value was read first. And some
asynchronous
050          * event can happen between these two events introducing
errors in lpj.
051          *
052          * So, we do
053          * 1. pre_start <- When we are sure that jiffy switch
hasn't happened
054          * 2. check jiffy switch
055          * 3. start <- timer value before or after jiffy switch
056          * 4. post_start <- When we are sure that jiffy switch has happened
057          *
058          * Note, we don't know anything about order of 2 and 3.
059          * Now, by looking at post_start and pre_start difference, we can
060          * check whether any asynchronous event happened or not
061          */
I am not clear with why is that pre_start condition being checked.How
is happening of jiffy switch here affecting the logic of the
calibrate.c and why is it important?

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux