On Sat, 2006-Jul-29 21:05:29 +0200, Sten Daniel Srsdal wrote: >Peter Jeremy wrote: >> In a MP configuration where it doesn't particularly matter if a >> particular update gets counted this time or next time, I think the >> cheapest option is to have per-CPU 32-bit counters (so no locks are >> needed to update the counters) with a polling function to accumulate >> all the individual counters into a 64-bit total. This pushes the cost >> from the update (very frequent) into the read (which is relatively >> infrequent), for a lower overall cost. >Is caching necessary somewhere or can the function return the value >directly without storing the global accumulated counter? If you want a 64-bit final result that takes into account overflows in the 32-bit per-CPU counters, then you will need some way to keep track of the number of overflows in each counter. -- Peter Jeremy
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:58 UTC