Subject: Re: SMP & ntpd interaction?
To: None <tech-kern@netbsd.org>
From: David Laight <david@l8s.co.uk>
List: tech-kern
Date: 01/18/2003 13:08:24
> 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).
It will save having to grab the lock to read the time - since the
reader won't (usually) care whether the value obtained is before
or after the update, it just doesn't want a partially updated
value.
Only the alignment of the global data matters, doublework access
to the local data isn't required.
On a related note, all the reference counters on data structures
have to be protected by a lock, ptr->ref++ wont be atomic on
memory. Statistics counters can (probably) be allowed to miscount.
David
--
David Laight: david@l8s.co.uk