Subject: re: SMP & ntpd interaction?
To: David Laight <david@l8s.co.uk>
From: matthew green <mrg@eterna.com.au>
List: tech-kern
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 defined(MULTIPROCESSOR)
/*
* If we are not the primary CPU, we're not allowed to do
* any more work.
*/
if (CPU_IS_PRIMARY(ci) == 0)
return;
#endif
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..
.mrg.