On 11 Jul 2010, at 04:18, Gabor PALI wrote:

> On Sat, Jul 10, 2010 at 5:24 PM, Robert N. M. Watson
> <rwat...@freebsd.org> wrote:
>> If we can do it in one atomic in the common case, and two atomics in an edge 
>> case, that sounds fine. I think any use of locking(9) would be sufficiently 
>> costly as to not be worth the improvements in consistency, given the 
>> frequency of statistics operations.
> 
> I have tried to use atomic operations for counting (without
> locking(9)), but they turned out to be significantly slower than the
> naive case indeed.  If consistency is not so important for statistics,
> whether would it be safe to simply use 64-bit variables for counters
> everywhere on all architectures?

I think the worry comes down to: an occasional missed packet is OK, but a 
duplicated carry(for example)  from the lower 32 bits to the upper 32 bits 
would put the counter off by 4 billion, which is not really acceptable.

What sort of measurement did you do to show the speed loss, BTW?

Robert

_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to