struct timehands: th_generation field

Ian Lepore ian at freebsd.org
Thu Jul 23 15:28:49 UTC 2015


On Thu, 2015-07-23 at 10:59 -0400, Brandon Allbery wrote:
> On Thu, Jul 23, 2015 at 10:38 AM, <deco33000 at yandex.com> wrote:
> 
> > Is the maximum value for th_generation equal to 10 ?
> > http://fxr.watson.org/fxr/source/kern/kern_tc.c?v=FREEBSD10#L77
> >
> 
> I don't think those relate to generations. Generations change on every
> clock tick; the multiple timehands structs relate to forcibly setting the
> time, as opposed to the clock moving forward normally. It does appear serve
> a similar purpose, since forcibly setting the time is even more "violent"
> (to anything currently reading the clock) than advancing the clock on a
> clock tick, since that's when other adjustments including possibly
> switching the clock source will be applied.
> 

Ummm, no.  The multiple timehands and related generation count are all
about time moving forward normally, and doing so without needing mutxes
or other locking primitives to obtain the current time.  I think you
guys need to read this...

  http://phk.freebsd.dk/pubs/timecounter.pdf

Especially the section named "Locking, lack of..."

-- Ian




More information about the freebsd-stable mailing list