periodically save current time to time-of-day hardware

John Baldwin jhb at freebsd.org
Mon Mar 29 16:16:40 UTC 2010


On Sunday 28 March 2010 7:45:25 am Dag-Erling Smørgrav wrote:
> Peter Jeremy <peterjeremy at acm.org> writes:
> > A new kthread which sleeps on channel "update_rtc".  When woken, it
> > checks to see if it's within (say) 50msec of a second boundary and so,
> > it does a trylock on the (new) RTC mutex.  If it grabs the mutex then
> > it performs the update.  If it was too far from the second boundary or
> > it fails to grab the mutex then it sleeps until the next second
> > boundary and tries again.
> >
> > The existing resettodr() would then turn into a wakeup(update_rtc).
> 
> Sounds good to me, but if only that thread has access to the RTC, why
> bother with a mutex?

I would dispense with the kthread and just use a callout (or have a callout 
schedule a task for taskqueue_thread).

-- 
John Baldwin


More information about the freebsd-hackers mailing list