Subject: re: SMP & ntpd interaction?
To: David Laight <firstname.lastname@example.org>
From: matthew green <email@example.com>
Date: 01/19/2003 00:45:38
> All cases could be handled by first making a local copy of the time
> value to be modified, update that and store it back into the global
> variable. To do this, we need two operations like: ATOMIC_READTIMEVAL
> and ATOMIC_WRITETIMEVAL.
That will only work if there is only one writer (or any updating
is always done with some lock held).
there is only one writer - see kern_clock.c:hardclock():
* If we are not the primary CPU, we're not allowed to do
* any more work.
if (CPU_IS_PRIMARY(ci) == 0)
Statistics counters can (probably) be allowed to miscount.
one way to avoid having counters lose is to count them on a per-cpu
basis and have programs tally them when required, or perhaps have
something like hardclock() tally into the normal global every tick..