Re: vmstat's entries type

From: Peter Jeremy <peterjeremy_at_optushome.com.au>
Date: Sun, 30 Jul 2006 06:52:20 +1000
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

Received on Sat Jul 29 2006 - 18:52:26 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:58 UTC