Re: vmstat's entries type

From: Michal Mertl <mime_at_traveller.cz>
Date: Sat, 29 Jul 2006 18:13:32 +0200
Peter Jeremy wrote:
> On Fri, 2006-Jul-28 14:47:01 +0100, Brian Candler wrote:
> >On Fri, Jul 28, 2006 at 09:28:36AM -0400, John Baldwin 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.

What you describe has already been there for some time.

>From sys/sys/pcpu.h

#define PCPU_LAZY_INC(var)      (++*PCPU_PTR(var))

and function vcnt from sys/vm/vm_meter.c


Michal
Received on Sat Jul 29 2006 - 14:13:50 UTC

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